Google
SQL Question Papers

Print this page

 

 

Question Paper for Structured Query Language

1. What does SQL stand for?

Structured Question Line
Structured Query Language
Strong Question Language

2. Which SQL command extracts data from a database?

EXTRACT
GET
OPEN
SELECT

3. Which SQL command updates data in a database?

UPDATE
SAVE
SAVE AS

4. Which SQL command deletes data from a database?

REMOVE
BLANK
DELETE

5. Which SQL command inserts new data in a database

ADD
NEW
PUT
INSERT

6. With SQL, how do you select the column named "FirstName" from a table named "Persons" ?

SELECT FirstName FROM Persons
SELECT Persons,FirstName
EXTRACT FirstName FROM Persons

7. With SQL, how do you select all the columns from a table named "Persons" ?

SELECT Persons
SELECT *.Persons
SELECT * FROM Persons
SELECT [all] FROM PERSONS

8. With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" ?

SELECT * FROM Persons LIKE 'Peter'
SELECT * FROM Persons WHERE FirstName='Peter'
SELECT * FROM Persons WHERE FirstName:'Peter'
SELECT [all] FROM Persons LIKE FirstName:'Peter'

9. With SQL, how do you select all the records from a table named "Persons" where the "FirstName" starts with an "a" ?

SELECT * FROM Persons WHERE FirstName='a'
SELECT * FROM Persons WHERE FirstName LIKE 'a%'
SELECT * FROM Persons WHERE FirstName LIKE '%a'
SELECT * FROM Persons LIKE FirstName='%a'

10. The AND operator displays a record if ANY conditions listed are true. The OR operator displays a record if ALL of the conditions listed are true

False
True

11. With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson" ?

SELECT FirstName='Peter' LastName='Jackson' FROM Persons
SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'
You can not do that with SQL

12. With SQL, how do you select all the records where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen" ?

SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'
SELECT * FROM Persons WHERE LastName>'Hansen', LastName<'Pettersen'
SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons
SELECT * FROM customers WHERE LastName>'Hansen' AND LastName>'Pettersen'

13. Which SQL keyword is used to return only different values?

COUNT
NOSAME
SC
DISTINCT

14. Which SQL keyword is used to sort the result?

ORDER BY
ORDER
SORT-ORDER
SORT

15. With SQL, how can you return all the records from a table named "Persons" sorted REVERSE alphabetically by "FirstName" ?

SELECT * FROM Persons SORT REVERSE 'FirstName'
SELECT * FROM Persons ORDER BY -'FirstName'
SELECT * FROM Persons WHERE FirstName ORDER BY FirstName DESC
SELECT * FROM Persons ORDER BY FirstName DESC

16. With SQL, how can you insert a new record into the "Persons" table?

INSERT INTO Persons VALUES ('Jimmy', 'Jackson')
INSERT ('Jimmy', 'Jackson') INTO Persons
INSERT VALUES ('Jimmy', 'Jackson') INTO Persons

17. With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?

INSERT INTO Persons (LastName) VALUES ('Olsen')
INSERT INTO Persons ('Olsen') INTO LastName
INSERT ('Olsen') INTO (LastName) FROM Persons

18. How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons Table?

SAVE Persons SET LastName = 'Nilsen' WHERE LastName = 'Hansen'
SAVE Persons SET LastName = 'Hansen' INTO LastName = 'Nilsen
UPDATE Persons SET LastName = 'Hansen' INTO LastName = 'Nilsen'
UPDATE Persons SET LastName = 'Nilsen' WHERE LastName = 'Hansen'

19. With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?

DELETE FirstName='Peter' FROM Persons
DELETE ROW FirstName='Peter' FROM Persons
DELETE FROM Persons WHERE FirstName = 'Peter'

20. With SQL, how can you return the number of records in the "Persons" table?

SELECT NUMBER FROM Persons
SELECT COUNT(*) FROM Persons
COUNT Persons
RETURN COLUMNS FROM Persons

 

 


  Questions Bank Home More Questions-->.

 

 

Do you have something to add to this document? Send your comments

On this Page
 

On InterviewFundas.com
Questions Bank Home
 

Related links to other sites

 

 
 Top  
 
   

You are visitor number :