wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

SQL Exam

Total questions: 23

Worksheet time: 12mins

Name
Class
Date
1.

What does SQL stand for?

a)

Strong Question Language

b)

Structured Query Language

c)

Structured Question Language

2.

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

a)

EXTRACT

b)

OPEN

c)

SELECT

d)

GET

3.

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

a)

SAVE

b)

SAVE AS

c)

UPDATE

d)

MODIFY

4.

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

a)

DELETE

b)

REMOVE

c)

COLLAPSE

5.

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

a)

INSERT INTO

b)

INSERT NEW

c)

ADD NEW

d)

ADD RECORD

6.

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

a)

EXTRACT FirstName FROM Persons

b)

SELECT FirstName FROM Persons

c)

SELECT Persons.FirstName

7.

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 LIKE 'Peter'

c)

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

d)

SELECT * FROM Persons WHERE FirstName<>'Peter'

8.

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

b)

SELECT * FROM Persons WHERE FirstName LIKE 'a%'

c)

SELECT * FROM Persons WHERE FirstName LIKE '%a'

d)

SELECT * FROM Persons WHERE FirstName='a'

9.

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

10.

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'

11.

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 BETWEEN 'Hansen' AND 'Pettersen'

c)

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

12.

Which SQL statement is used to return only different values?

a)

SELECT DIFFERENT

b)

SELECT UNIQUE

c)

SELECT DISTINCT

13.

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

a)

SORT

b)

SORT BY

c)

ORDER

d)

ORDER BY

14.

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

b)

SELECT * FROM Persons ORDER BY FirstName DESC

c)

SELECT * FROM Persons ORDER FirstName DESC

d)

SELECT * FROM Persons SORT BY 'FirstName' DESC

15.

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

a)

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

b)

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

c)

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

16.

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)

17.

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

a)

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

b)

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

c)

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

d)

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

18.

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

a)

DELETE FirstName='Peter' FROM Persons

b)

DELETE FROM Persons WHERE FirstName = 'Peter'

c)

DELETE ROW FirstName='Peter' FROM Persons

19.

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

a)

SELECT COUNT(*) FROM Persons

b)

SELECT COLUMNS(*) FROM Persons

c)

SELECT LEN(*) FROM Persons

d)

SELECT NO(*) FROM Persons

20.

What is the most common type of join?

a)

JOINED

b)

INSIDE JOIN

c)

JOINED TABLE

d)

INNER JOIN

21.

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

a)

true

b)

false

22.

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

a)

GET

b)

LIKE

c)

FROM

23.

Which SQL statement is used to create a database table called 'Customers'?

a)

CREATE DATABASE TAB Customers

b)

CREATE DB Customers

c)

CREATE DATABASE TABLE Customers

d)

CREATE TABLE Customers