Computer Science - SQL 1 Quiz
Enter your name, print this page, and hand it in. (no pattern)
Name:    Date:  
1. What does SQL stand for?
a. Structured Question Language c. Structured Query Language
b. Strong Question Language d. Small Quaint Language
2. Which SQL statement is used to extract data from a database?
a. EXTRACT c. OPEN
b. GET d. SELECT
3. Which SQL statement is used to update data in a database?
a. SAVE AS c. SAVE
b. MODIFY d. UPDATE
 4. Which SQL statement is used to delete data from a database?
a. REMOVE c. TRUNCATE
b. DELETE d. SANCTION
 5. Which SQL statement is used to insert new data in a database?
a. ADD RECORD c. INSERT
b. INSERT NEW d. ADD NEW
6. With SQL, how do you select a column named "FirstName" from a table named "Persons"?
a. SELECT Persons.FirstName c. SELECT FirstName FROM Persons
b. EXTRACT FirstName FROM Persons d. SELECT Persons FROM FirstName
7. With SQL, how do you select all the columns from a table named "Persons"?
a. SELECT [all] FROM Persons c. SELECT *.Persons
b. SELECT Persons d. SELECT * FROM Persons
8. With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?
a. SELECT * FROM Persons WHERE FirstName LIKE 'Peter' c. SELECT [all] FROM Persons WHERE FirstName='Peter'
b. SELECT * FROM Persons WHERE FirstName='Peter' d. SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'
9. With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?
a. SELECT * FROM Persons WHERE FirstName='%a%' c. SELECT * FROM Persons WHERE FirstName='a'
b. SELECT * FROM Persons WHERE FirstName LIKE '%a' d. SELECT * FROM Persons WHERE FirstName LIKE 'a%'
10. The OR operator displays a record if ANY conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true
a. True b. False
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"?
a. SELECT FirstName='Peter', LastName='Jackson' FROM Persons c. SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'
b. SELECT * FROM Persons WHERE FirstName LIKE 'Peter' AND LastName LIKE 'Jackson' d. SELECT ALL FROM Persons WHERE FirstName LIKE 'Peter' AND LastName LIKE 'Jackson'
12. With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"?
a. SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen' c. SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen'
b. SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons d. SELECT * FROM Persons WHEN LastName>'Hansen' AND LastName<'Pettersen'
13. Which SQL statement is used to return only different values?
a. SELECT DISTINCT c. SELECT DIFFERENT
b. SELECT UNIQUE d. SELECT ONLY
14. Which SQL keyword is used to sort the result-set?
a. ORDER BY c. ORDER
b. SORT BY d. SORT
15. With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?
a. SELECT * FROM Persons SORT 'FirstName' DESC c. SELECT * FROM Persons ORDER BY FirstName DESC
b. SELECT * FROM Persons SORT BY 'FirstName' DESC d. SELECT * FROM Persons ORDER FirstName DESC
16. With SQL, how can you insert a new record into the "Persons" table?
a. INSERT VALUES ('Jimmy', 'Jackson') INTO Persons c. INSERT INTO Persons VALUES ('Jimmy', 'Jackson')
b. INSERT ('Jimmy', 'Jackson') INTO Persons d. PUT INTO Persons VALUES ('Jimmy', 'Jackson')
 17. With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?
a. INSERT INTO Persons ('Olsen') INTO LastName c. INSERT INTO Persons (LastName) VALUES ('Olsen')
b. INSERT ('Olsen') INTO Persons (LastName) d. PUT ('Olsen') INTO Persons (LastName)
18. How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?
a. MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen' c. UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen'
b. MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen d. 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?
a. DELETE FirstName='Peter' FROM Persons c. DELETE ROW FirstName='Peter' FROM Persons
b. DELETE FROM Persons WHERE FirstName = 'Peter' d. DELETE FROM Persons
20. With SQL, how can you return the number of records in the "Persons" table?
a. SELECT COUNT(*) FROM Persons c. SELECT COUNT() FROM Persons
b. SELECT COLUMNS() FROM Persons d. SELECT COLUMNS(*) FROM Persons