wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

01. SQL Quiz

Total questions: 12

Worksheet time: 6mins

Name
Class
Date
1.

Which SQL keyword is used to retrieve data from a database?

a)

SELECT

b)

UPDATE

c)

INSERT

d)

DELETE

2.

What will this query return?

a)

All employees

b)

Only employees younger than 30

c)

Employees older than 30

d)

Error

3.

What is the function of the PRIMARY KEY in a table?

a)

Allows duplicate values in a column

b)

Ensures unique values and identifies each row

c)

Automatically sorts the table

d)

Acts as a foreign key

4.

Given a table products(id, name, price), what does this query do?

a)

Selects all products cheaper than 3

b)

Selects the 3 most expensive products

c)

Selects the 3 cheapest products

d)

Error

5.

Which SQL statement is used to add new rows into a table?

a)

ADD

b)

APPEND

c)

INSERT INTO

d)

CREATE

6.

What is the result of this query?

a)

Counts all rows in orders

b)

Counts only orders with status "shipped"

c)

Returns the total number of columns

d)

Error

7.

What does a FOREIGN KEY do?

a)

Ensures unique values within a table

b)

Links two tables together using a common column

c)

Stores secret data

d)

Automatically indexes the table

8.

What will this query return?

a)

Total salary for each department

b)

Average salary for each department

c)

Minimum salary for each department

d)

Error

9.

What is the purpose of a JOIN in SQL?

a)

To combine rows from two or more tables based on a related column

b)

To remove duplicate rows from a table

c)

To insert data into multiple tables at once

d)

To create a backup of the database

10.

What is the difference between INNER JOIN and LEFT JOIN

a)

INNER JOIN returns all rows from both tables

b)

LEFT JOIN returns all rows from the left table, even if no match exists in the right table

c)

INNER JOIN includes unmatched rows as NULL

d)

No difference

11.

What will this query return?

a)

Only customers who made orders

b)

All customers, with their orders if available

c)

Only orders without customers

12.

What does this query return?

a)

All customers

b)

Customers who have made more than 5 orders

c)

Customers who have not placed any orders

d)

Error