Skip to main content

Exam 2: Filtering with WHERE

Difficulty: Beginner+

Topics covered: WHERE, AND, OR, comparison operators

Each question shows the target output. Write a SQL query that produces exactly those columns and rows.


Question 1

Retrieve all columns from orders where the status is 'completed'.

⌘ / Ctrl + Enter to run

Question 2

Retrieve all columns from products where the price is greater than 100.

⌘ / Ctrl + Enter to run

Question 3

Retrieve all columns from customers where the country is 'USA'.

⌘ / Ctrl + Enter to run

Question 4

Retrieve all columns from orders where total_amount is greater than 500 and the status is 'completed'.

⌘ / Ctrl + Enter to run

Question 5

Retrieve all columns from orders where the status is 'pending' or 'cancelled'.

⌘ / Ctrl + Enter to run

Question 6

Retrieve all columns from orders that have not been completed, including orders where no status has been recorded yet.

tip

A simple <> comparison silently skips rows where status is NULL. You will need an extra condition to catch those rows.

⌘ / Ctrl + Enter to run
Donate to this project