wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

SQL Practice Questions

Total questions: 107

Worksheet time: 1hrs 6mins

Name
Class
Date
1.
Which of the following is not a data type?
a)
Number
b)
Text
c)
Word
d)
Desk
2.

What does "SQL" stand for?

a)

Structured Question Language

b)

Structured Query Language

c)

Simple Query Language

d)

Simple Question Language

3.

Which statement is used to extract data from a database?

a)

Extract

b)

Get

c)

Open

d)

Select

4.

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

a)

Where

b)

Order by

c)

From

d)

Select

5.

Using which word allows you to specify that more than one condition must be met in a query?

a)

Also

b)

And

c)

Or

d)

Where

6.

Using which word allows you to specify that only one of a series of conditions needs to be met in a query filter?

a)

And

b)

Maybe

c)

If

d)

Or

7.

In order to amend data in a database we would use which SQL statement?

a)

Update

b)

Amend

c)

Alter

d)

Modify

8.

Less than or equal to?

a)

>=

b)

=>

c)

=<

d)

<=

9.

Which character returns all the data found in a table?

a)

%

b)

#

c)

*

d)

/

10.

Which word is missing from the following SQL statement?


Select * table_name

a)

With

b)

Where

c)

From

d)

And

11.

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

12.

How do we select all rows for the "Designer" table?

a)

SELECT * FROM Designer

b)

SELECT [All] FROM Designer

c)

SELECT Designer.*

d)

SELECT FROM Designer

13.

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

14.

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

15.

Which SQL statement can eliminate duplicate rows?

a)

SELECT UNIQUE

b)

SELECT DIFFERENT

c)

SELECT INDEX

d)

SELECT DISTINCT

16.

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

17.

Which symbol would you use to represent more than 50

a)

= 50

b)

< 50

c)

> 50

d)

# 50

18.
What is the correct answer?
a)
Select * from "Database"
b)
Select * from "Name table";
c)
SELECT * from "Name table"
d)
Select * from "name Database";
19.
Where we write (;)?
a)
The beginning of the line
b)
The end of the line
20.
what is the word used to retrieve data from tables.
a)
From
b)
*
c)
SELECT
21.
What is the correct answer?
a)
select DISTINCT   'table name '    *    from 'column name';
b)
select DISTINCT  ' table name'   from  ' table name ';
c)
SELECT distinct 'name table' from 'column name ';
d)
SELECT distinct 'column  name ' from 'name table';
22.
Where we write (,)?
a)
between the databases names.
b)
between the column names.
23.
You can type a SQL statement by capital letters and lowercase letters.
a)
 False
b)
True
24.
You can't  type SQL statement in more lines.
a)
False
b)
True
25.
What is the benefit of the tool (*)
a)
Retrieving some  columns  from the table.
b)
Retrieving all columns from the table.
26.
select name from students;
a)
Will give you all information
b)
Will give you last name information
c)
Will give you Name information
27.
 Complete the solution:
Select * ............ 'table name ..........
a)
from        ,
b)
,          from
c)
from         ;
d)
;         from
28.

'x OR y' returns a value from a database...

a)

only if both x and y are true.

b)

if either x or y, or both x and y are true.

c)

if x is false.

d)

only if both x and y are true.

29.

What would the SQL query pictured do?

a)

Find all the men

b)

Find all of the female writers

c)

Find all of Elgar's friends

d)

Find all the male writers

e)

Find all the fish

30.

What would the query pictured do?

a)

Find all of Elgar's friends who were born in 1869

b)

Find all of Elgar's family who were born in the 1860s.

c)

Find all the the ducks in Birmingham.

d)

Find all of Elgar's colleagues born in 1860.

e)

Find all of Elgar's colleagues who were born in the 1860s.

31.
What word is missing from the line below?
SELECT *
_______ CUSTOMER;
a)
FROM
b)
WHERE
c)
SELECT
d)
ORDER BY
32.

How would you find out the nature of Elgar's relationship with the member of his database who was a shop assistant?SELECT RelationshipToElgar FROM Elgar's Friends WHERE Occupation = 'Shop Assistant'

a)

SELECT Connection FROM Elgar's Friends WHERE Occupation = 'Shop Assistant'

b)

SELECT RelationshipToElgar FROM Table WHERE Occupation = 'Shop Assistant'

c)

SELECT RelationshipToElgar FROM Elgar's Friends WHERE Job = 'Shop Assistant'

d)

SELECT RelationshipToElgar IN Elgar's Friends WHERE Occupation = 'Shop Assistant'

e)

CHOOSE RelationshipToElgar FROM Elgar's Friends WHERE Occupation = 'Shop Assistant'

33.
What is the purpose of  *?
a)
Selects ALL fields from the table
b)
Selects only the first field in the table
c)
Selects the last field in the table
d)
Shows only the first row in the table
34.
Return only the customers who have ER anywhere in their last name. 
a)
last_name LIKE "%er%"
b)
last_name = "%er"
c)
last_name = "%er%"
d)
last_name LIKE "%er"
35.
To find the total dollar value of sales, use which? 
a)
SUM
b)
COUNT
c)
MAX
d)
MIN
36.
You must always use _____ when filtering string values.
a)
quotes
b)
astericks
c)
exclamation point
d)
percent signs
37.
To join a table, connect the ___________ of one table to the ___________ of the other.
a)
primary key, foreign key
b)
group by clause, primary key
c)
filtered by, foreign key
d)
aggregate function, where clause
38.
Which clause allows you to SORT data?
a)
ORDER BY
b)
WHERE
c)
FROM
d)
HAVING
39.
True/False?
SQL table names are case sensitive
a)
True
b)
False
40.
Use which clause to FILTER data?
a)
WHERE
b)
ORDER BY
c)
FROM
d)
HAVING
41.
Which word allows you to add more than one filter to a SQL query?
a)
AND
b)
BETWEEN
c)
LIKE
d)
EQUALS
42.
A column in a database
a)
record
b)
row
c)
field
d)
data
43.
What is wrong with this SQL?
a)
It should be UPDATE
b)
It has too many commas
c)
The table name is wrong
d)
Too many fields
44.

How many fields are there?

a)

4

b)

5

c)

6

d)

7

45.

Which field is the key field?

a)

ID

b)

Name

c)

HighScore

d)

Competition

46.

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

47.

What is the ID of the records that are returned when the SQL statement "SELECT * FROM Gymnasts WHERE HighScore > 8.4"?

a)

0001

b)

0002

c)

0003

d)

0004

e)

0005

48.

Which of the following statements will return the most records?

a)

SELECT * FROM Gymnasts WHERE HighScore > 8.0

b)

SELECT * FROM Gymnasts WHERE Competition LIKE R%

c)

SELECT * FROM Gymnasts WHERE Competition LIKE %o%

d)

SELECT * FROM Gymnasts WHERE Name LIKE %i%

49.

How many records are there in this table?

a)

6

b)

7

c)

9

d)

42

50.

How many records would be returned by the following SQL "SELECT * FROM songs WHERE TimesPlayed >=3

a)

0

b)

2

c)

3

d)

4

51.

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

52.
To return strings that match a wildcard value, use which word in your filter?
a)
LIKE
b)
EQUALS
c)
BETWEEN
d)
SEARCH
53.
What represents no value? 
a)
NULL
b)
" "
c)
0
d)
N/A
54.
Expressions cannot contain variables of different data types.
a)
False
b)
True
55.
If you store a smaller number in an integer, (say 10 instead of 1234,) it will take up less memory.
a)
False
b)
True
56.
Integers cannot store negative numbers.
a)
False
b)
True
57.
Data types of variables can never be changed.
a)
False
b)
True
58.
What data type would be best used to record an email address?
a)
String
b)
Integer
c)
Real
d)
Character
59.
What data type would be the answer to the expression x < 5?
a)
Boolean
b)
Character
c)
Real
d)
String
60.
To decrease the number of mistakes when inputting data into a database, we use two techniques:
a)
Verification and validation.
b)
Validation and virus checking.
c)
Backup and virus checking.
d)
Searching for duplicates and erasing empty rows.
61.
Validates ensures that data is fit for purpose which means the data is:
a)
sensible and reasonable
b)
accurate and fact-checked
c)
spelled correctly
62.
The following is true about validation:
a)
It is performed by software
b)
It is performed by a human
c)
It requires everything to be typed twice, e.g. a new password.
63.
Most database software has sophisticated verification routines.
a)
False
b)
True
64.
When inputting UK customers into a table, this type of validation will prevent non-UK postal codes to be entered:
a)
Format check
b)
Presence check
c)
Range check
d)
Check digit
65.
When inputting credit card customers into a table, this type of validation will prevent invalid numbers to be entered:
a)
All of these
b)
Length check
c)
Check digit
d)
Format check
66.
A user is entering valid but highly unusual data, e.g. age of 113 years. The following is true:
a)
A special routine needs to run, getting the user to confirm and flag this entry up for human verification.
b)
Unusual data is invalid, clearly a person 113 years of age will not be entered in database. It needs to be rejected.
c)
It is possible that a customer can be indeed be 113 years old. The data should be treated as any other.
67.
The following mistakes will not be picked up by any validation:
a)
13 Broad Street instead of 12 Broad Street
b)
0 Broad Street instead of 12 Broad Street
c)
5 Broad Avenue instead of 5 Broad Street
68.
Sometimes validation will prevent valid data from being input
a)
True
b)
False
69.
Validation checks if data is correct
a)
False
b)
True
70.
What is meant by a database?
a)
A persistent store of organised data.
b)
Used to calculate financial data and for modelling.
71.
What is meant by the phrase persistent storage?
a)
Volatile storage of data on a secondary storage device like a hard disk.
b)
 Non-volatile storage of data on a secondary storage device like a hard disk.
72.
Give two examples of a paper-based database.
a)
Address Book
b)
Diary
c)
Calendar
d)
Mobile Phone Contacts
73.
Which of the following is NOT an advantage of computer based databases over paper based databases.
a)
Easily organise the data using sort (ascending/descending) or filters.
b)
Can be backed up to avoid loss.
c)
Can be shared with colleagues by attaching to emails.
d)
They have to be locked in filing cabinets.
74.
Define the term 'field'.
a)
A field in a table that uniquely identifies a record.
b)
A collection of data organised into records and fields.
c)
Data stored about one instance of an entity e.g. one person or one object.
d)
One specific data item being stored such as surname or date.
75.
How many fields are in this table?
a)
6
b)
10
76.
Define the term 'record'.
a)
Data stored about one instance of an entity e.g. one person or one object.
b)
A collection of data organised into records and fields.
c)
One specific data item being stored such as surname or date.
d)
A field in a table that uniquely identifies a record.
77.
What is meant by an 'entity'?
a)
A collection of data organised into records and fields.
b)
A category of, for example a person, object or event about which data is stored in a table.
c)
A field in a table that uniquely identifies a record.
d)
One specific data item being stored such as surname or date.
78.
How many records are in this table?
a)
6
b)
10
79.
What is meant by a primary key?
a)
A field in a table that uniquely identifies a record.
b)
A field in one table that is the primary key in another table, used to create a relationship between two tables.
80.
What is meant by a foreign key?
a)
A field in a table that uniquely identifies a record.
b)
A field in one table that is the primary key in another table, used to create a relationship between two tables.
81.
What is meant by a 'table'?
a)
A category of, for example a person, object or event about which data is stored in a table.
b)
A field in a table that uniquely identifies a record.
c)
Represents a real world entity.  Organised into records and rows.
d)
Data stored about one instance of an entity e.g. one person or one object.
82.
What is meant by a 'table'?
a)
A category of, for example a person, object or event about which data is stored in a table.
b)
A field in a table that uniquely identifies a record.
c)
Represents a real world entity.  Organised into records and rows.
d)
Data stored about one instance of an entity e.g. one person or one object.
83.
What is meant by data redundancy/duplication?
a)
Where the same data is stored more than once unnecessarily.
b)
Where different versions of the same data have different values because duplicate versions have been stored and updated differently.
84.
Which of the following are logical operators that can be used in database queries?
a)
AND
b)
OR
c)
NOT
d)
All 3 are logical operators.
85.
Which feature of a DBMS enables a database to be interrogated based on specific criteria?
a)
Query.
b)
Report
c)
Form
d)
Relationship
86.
Which clause allows you to SORT data?
a)
ORDER BY
b)
WHERE
c)
FROM
d)
HAVING
87.
What is the correct order of clauses? 
a)
SELECT, FROM, ORDER BY, WHERE
b)
SELECT, FROM, WHERE, ORDER BY
c)
SELECT, WHERE, FROM, ORDER BY
d)
WHERE, FROM, SELECT, ORDER BY
88.
Use which clause to FILTER data?
a)
WHERE
b)
ORDER BY
c)
FROM
d)
HAVING
89.
What does SQL stand for?
a)
 Structured Query Language
b)
 Structured Question Language
c)
 Strong Question Language
d)
 Strong Query Language
90.
Which SQL statement is used to insert new data in a database?
a)
 ADD NEW
b)
 ADD RECORD
c)
 INSERT NEW
d)
 INSERT INTO
91.
Boolean Data is?
a)
True or False
b)
Numbers
c)
Letters
d)
Special Characters
92.

In a database, records of data are kept in tables.

a)

True

b)

False

93.

In a table, a record is

a)

a group of data about one thing, one person or one event.

b)

a compilation of songs to play

c)

a plastic sheet with data on it

94.

SELECT * FROM students;

This will show

a)

1 record from the "students" table

b)

all the records in the "students" table

c)

first 10 records of "students" table

d)

all the boys in the table "students"

95.

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

96.

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

97.

Match the following SQL term with a description - SELECT

a)

The fields to display

b)

The table used in the query

c)

The criteria which must be met

d)

The field and order used to sort the results

98.

Match the following SQL term with a description - WHERE

a)

The table used in the query

b)

The fields to display

c)

The field and order used to sort the results

d)

The criteria which must be set

99.

Match the following SQL term with a description - ORDER BY

a)

The fields to display

b)

The field and order used to sort the results

c)

The table used in the query

d)

The criteria that must be met

100.

When examining a row in a table, we refer to it as a...

a)

row number

b)

result number

c)

record

d)

result

101.

When examining a column in a table, we refer to it as a...

a)

field name

b)

folder name

c)

column number

d)

table name

102.

When defining a table, each field name has both a ...

a)

table name and a database

b)

command and an argument

c)

goal and a purpose

d)

name and a data type

103.

Which of the queries is most likely to have produced this result?

a)

ANSWER: SELECT id, name, year FROM movies WHERE year > 2010;

b)

ANSWER: SELECT id, name, year FROM movies WHERE year < 2010;

c)

ANSWER: SELECT * FROM movies WHERE year > 2010;

d)

ANSWER: SELECT id, name, year FROM movies WHERE YEAR > 2010;

104.
What is missing in this code? SELECT * FROM WHERE genre = ‘action’ ORDER BY year ASC;
a)
Missing an AND
b)
Table name
c)
Capitalize action
d)
None of these
105.
Use what to remove spaces from the beginning and end of the string value?
a)
TRIM
b)
CROP
c)
NOSPACE
d)
SPACE
106.
Which SQL statement is used to update data in a database?
a)
MODIFY
b)
 SAVE AS
c)
UPDATE
d)
SAVE
107.
Which of these groups are in the six common operators?
a)
#=, ^=, $=
b)
=, !=, >=
c)
>^, <>, =+
d)
<+>, >=<, (<)