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'.
Question 2
Retrieve all columns from products where the price is greater than 100.
Question 3
Retrieve all columns from customers where the country is 'USA'.
Question 4
Retrieve all columns from orders where total_amount is greater than 500 and the status is 'completed'.
Question 5
Retrieve all columns from orders where the status is 'pending' or 'cancelled'.
Question 6
Retrieve all columns from orders that have not been completed, including orders where no status has been recorded yet.
A simple <> comparison silently skips rows where status is NULL. You will need an extra condition to catch those rows.