wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

J277 - 2.2 - The use of SQL to search for data

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the purpose of the SQL SELECT statement?

a)

To delete data from a database

b)

To retrieve data from a database

c)

To update data in a database

d)

To insert data into a database

2.

Which clause is used to specify the table from which to retrieve data in an SQL query?

a)

SELECT

b)

WHERE

c)

FROM

d)

JOIN

3.

In the SQL statement `SELECT name, age FROM students WHERE age > 16;`, what does the WHERE clause do?

a)

It specifies the columns to be retrieved

b)

It specifies the table to retrieve data from

c)

It filters the data to include only students older than 16

d)

It orders the data by age

4.

Which of the following SQL statements will retrieve all columns from the "employees" table?

a)

SELECT * FROM employees;

b)

SELECT all FROM employees;

c)

SELECT columns FROM employees;

d)

SELECT everything FROM employees;

5.

How would you write an SQL query to select only the "name" and "email" columns from a table called "users"?

a)

SELECT name, email FROM users;

b)

SELECT name email FROM users;

c)

SELECT name AND email FROM users;

d)

SELECT name OR email FROM users;

6.

What does the following SQL query do? `SELECT * FROM products WHERE price < 20;`

a)

It selects all products with a price greater than 20

b)

It selects all products with a price less than 20

c)

It selects all products with a price equal to 20

d)

It selects all products with a price not equal to 20

7.

Which SQL keyword is used to filter records?

a)

SELECT

b)

FILTER

c)

WHERE

d)

ORDER

8.

In the SQL query `SELECT * FROM books WHERE author = 'J.K. Rowling';`, what is the condition being applied?

a)

The author is not 'J.K. Rowling'

b)

The author is 'J.K. Rowling'

c)

The book title is 'J.K. Rowling'

d)

The book genre is 'J.K. Rowling'

9.

What will the SQL query `SELECT name FROM cities WHERE population > 1000000;` return?

a)

Names of cities with a population less than 1,000,000

b)

Names of cities with a population greater than 1,000,000

c)

Names of cities with a population equal to 1,000,000

d)

Names of all cities

10.

Which of the following SQL queries will select all records from the "orders" table where the "status" is "shipped"?

a)

SELECT * FROM orders WHERE status = 'shipped';

b)

SELECT * FROM orders WHERE status IS 'shipped';

c)

SELECT * FROM orders WHERE status LIKE 'shipped';

d)

SELECT * FROM orders WHERE status IN 'shipped';