wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

sql

Total questions: 24

Worksheet time: 23mins

Name
Class
Date
1.

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends 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%’

2.

What does SQL stand for?

a)

Standard Query Language

b)

Sequential Query Language

c)

Structured Question Language

d)

Structured Query Language

3.

Match the following SQL term with a description - FROM

a)

The criteria which must be met

b)

The fields to display

c)

The field and order used to sort the results

d)

The table used in the query

4.

In what order does SQL process the instructions?

a)

FROM - SELECT - WHERE - ORDER BY

b)

WHERE - FROM - SELECT - ORDER BY

c)

SELECT - FROM - WHERE - ORDER BY

d)

SELECT - FROM - ORDER By - WHERE

5.

Which statement is used to extract data from a database?

a)

Extract

b)

Get

c)

Open

d)

Select

6.

Less than or equal to?

a)

>=

b)

=>

c)

=<

d)

<=

7.

A primary key can be NULL in the table? TRUE or FALSE

a)

TRUE

b)

FALSE

8.

SQL is

a)

Structured Query Language

b)

Simple Query Language

c)

Structured Question Language

d)

Structure Quality Language

9.

How many records are in this table?

a)

7

b)

6

c)

5

d)

4

10.

How many fields are there?

a)

4

b)

5

c)

6

d)

7

11.

Which field is the key field?

a)

ID

b)

Name

c)

HighScore

d)

Competition

12.

What is the ID of the records that are returned when the SQL statement "SELECT * FROM Gymnasts WHERE Name='Xavier'"?

a)

0001

b)

0002

c)

0003

d)

0004

e)

0005

13.

Which of the following is NOT a SQL command?

a)

SELECT

b)

FROM

c)

LIKE

d)

SIMILAR

e)

DISTINCT

14.

How many fields are there in this table?

a)

6

b)

7

c)

9

d)

42

15.

How many records would be returned by the following SQL "SELECT * FROM songs WHERE Length < 3 AND Protected = True"?

a)

0

b)

2

c)

3

d)

4

16.

If you were wanting to filter data, which clause would you use?

a)

Where

b)

Order by

c)

From

d)

Select

17.

Which character returns all the data found in a table?

a)

%

b)

#

c)

*

d)

/

18.

Which word is missing from the following SQL statement?


Select * table_name

a)

With

b)

Where

c)

From

d)

And

19.

What is the correct order of clauses in a SQL statement?

a)

SELECT, FROM, ORDER BY, WHERE

b)

SELECT, FROM, WHERE, ORDER BY

c)

SELECT, WHERE, FROM, ORDER BY

d)

WHERE, FROM, SELECT, ORDER BY

20.

Which query would return only the fields DesignerID and Designer?

a)

SELECT * FROM Designers

b)

SELECT DesignerID, Name FROM Designers

c)

SELECT DesignerID AND Designer FROM Designers

d)

SELECT DesignerID, Designer FROM Designers

21.

How would we script a SQL query to select "Description" from the Item table?

a)

SELECT Item.Description

b)

EXTRACT Description FROM Item

c)

SELECT Item FROM Description

d)

SELECT Description FROM Item

22.

How would you display Chairs in the Items table that have a Price greater than £50.

a)

SELECT * FROM Items WHERE Type = 'Chair' AND Price > 50

b)

SELECT * FROM Items WHERE Type = 'Chair' OR Price < 100

c)

SELECT * FROM Iterms WHERE Type = 'Chair' AND Price >= 50

d)

SELECT * FROM Items WHERE Price > 50

23.

Find the name of those cities with temperature and condition whose condition is either sunny or cloudy but temperature must be greater than 70.

a)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ OR temperature > 70

b)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ OR temperature > 70

c)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ OR condition = ‘cloudy’ AND temperature > 70

d)

SELECT city, temperature, condition FROM weather WHERE condition = ‘sunny’ AND condition = ‘cloudy’ AND temperature > 70

24.

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends 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%’