wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

HAH Diagnostic Quiz

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.
What word is missing from the line below?
SELECT *
_______ CUSTOMER;
a)
FROM
b)
WHERE
c)
SELECT
d)
ORDER BY
2.
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
3.
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"
4.

What is a stored procedure in the context of databases?

a)

A mechanism to create backup copies of a database

b)

A table that holds temporary data during a session

c)

A data structure used to store complex data types

d)

A parameterized query that is stored in the database for reuse

5.

Which of the following statements accurately describes a one-to-many relationship in a database?

a)

A single record in one table corresponds to multiple records in another table.

b)

A single record in one table corresponds to a single record in another table.

c)

Multiple records in one table correspond to multiple records in another table.

d)

Multiple records in one table correspond to a single record in another table.

6.

What is the purpose of the CASCADE DELETE constraint in a database?

a)

To automatically update related records when a primary key value is modified

b)

To prevent the deletion of a record if it has related records in other tables

c)

To automatically delete related records when a primary key value is deleted

d)

To ensure that foreign key values are unique within a table

7.
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
8.

Which of the following is a valid SQL aggregate function?

a)

DISTINCT

b)

CONCATENATE

c)

AVERAGE

d)

EXTRACT

9.

What is the purpose of a primary key-foreign key relationship in a database?

a)

To enforce referential integrity between related tables

b)

To store complex data structures in a single table

c)

To optimize database performance by indexing columns

d)

To simplify data retrieval using JOIN statements

10.
Which clause allows you to SORT data?
a)
ORDER BY
b)
WHERE
c)
FROM
d)
HAVING
11.
When you select data from 2 tables, you are creating a ________. 
a)
JOIN
b)
PRIMARY KEY
c)
FOREIGN KEY
d)
INDEX
12.
What happens if you forget to join two tables together  using a WHERE clause?
a)
CREATE CARTESIAN PRODUCT
b)
GET A SYNTAX ERROR
c)
0 RECORDS RETURNED
d)
DELETE ALL
13.
True/False?
SQL table names are case sensitive
a)
True
b)
False
14.
How do you fix an ambiguous error in your SQL statement?
a)
Use long form of field name
b)
Remove that field name from the query
c)
Require unique fieldnames for all
d)
No such thing as ambiguous error
15.
Use which clause to FILTER data?
a)
WHERE
b)
ORDER BY
c)
FROM
d)
HAVING
16.
What represents no value? 
a)
NULL
b)
" "
c)
0
d)
N/A
17.
SELECT MAX(price)
FROM    PRODUCT
will return how many rows?
a)
1
b)
0
c)
2
d)
As many rows that are in the table
18.
Which word allows you to add more than one filter to a SQL query?
a)
AND
b)
BETWEEN
c)
LIKE
d)
EQUALS
19.
To return strings that match a wildcard value, use which word in your filter?
a)
LIKE
b)
EQUALS
c)
BETWEEN
d)
SEARCH
20.
Use what to remove spaces from the beginning and end of the string value?
a)
TRIM
b)
CROP
c)
NOSPACE
d)
SPACE