wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Sql Quiz

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

What does SQL stand for?

a)

Structured Query Language

b)

Strong Question Language

c)

Structured Question Language

2.

Which SQL statement is used to extract data from a database?

a)

SELECT

b)

OPEN

c)

GET

d)

EXTRACT

3.

Which SQL statement is used to update data in a database?

a)

UPDATE

b)

SAVE

c)

MODIFY

d)

SAVE AS

4.

Which SQL statement is used to delete data from a database?

a)

DELETE

b)

COLLAPSE

c)

REMOVE

5.

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

a)

SELECT Persons.FirstName

b)

EXTRACT FirstName FROM Persons

c)

SELECT FirstName FROM Persons

6.

Which SQL statement is used to insert new data in a database?

a)

INSERT INTO

b)

INSERT NEW

c)

ADD RECORD

d)

ADD NEW

7.

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

a)

SELECT [all] FROM Persons

b)

SELECT Persons

c)

SELECT * FROM Persons

d)

SELECT *.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='Peter'

b)

SELECT [all] FROM Persons WHERE FirstName='Peter'

c)

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 LIKE '%a'

b)

SELECT * FROM Persons WHERE FirstName='a'

c)

SELECT * FROM Persons WHERE FirstName LIKE 'a%'

d)

SELECT * FROM Persons WHERE FirstName='%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

b)

SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson'

c)

SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='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 LastName>'Hansen' AND LastName<'Pettersen' FROM Persons

b)

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

c)

SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen'

13.

Which SQL statement is used to return only different values?

a)

SELECT DISTINCT

b)

SELECT UNIQUE

c)

SELECT DIFFERENT

14.

Which SQL keyword is used to sort the result-set?

a)

SORT BY

b)

ORDER BY

c)

ORDER

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 ORDER BY FirstName DESC

b)

SELECT * FROM Persons ORDER FirstName DESC

c)

SELECT * FROM Persons SORT 'FirstName' DESC

d)

SELECT * FROM Persons SORT BY 'FirstName' DESC

16.

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

a)

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

b)

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

c)

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

17.

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

a)

INSERT INTO Persons ('Olsen') INTO LastName

b)

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

c)

INSERT ('Olsen') INTO Persons (LastName)

18.

How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table?

a)

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

b)

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

c)

MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen'

d)

MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen

19.

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

a)

DELETE ROW FirstName='Peter' FROM Persons

b)

DELETE FirstName='Peter' FROM Persons

c)

DELETE FROM Persons WHERE FirstName = 'Peter'

20.

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

a)

SELECT COUNT(*) FROM Persons

b)

SELECT LEN(*) FROM Persons

c)

SELECT NO(*) FROM Persons

d)

SELECT COLUMNS(*) FROM Persons

21.

What is the most common type of join?

a)

JOINED

b)

INNER JOIN

c)

INSIDE JOIN

d)

JOINED TABLE

22.

Which operator is used to select values within a range?

a)

RANGE

b)

WITHIN

c)

BETWEEN

23.

The NOT NULL constraint enforces a column to not accept NULL values.

a)

True

b)

False

24.

Which operator is used to search for a specified pattern in a column?

a)

FROM

b)

GET

c)

LIKE

25.

Which SQL statement is used to create a table in a database?

a)

CREATE DATABASE TABLE

b)

CREATE DB

c)

CREATE TABLE

d)

CREATE DATABASE TAB