Practice SQL WHERE Clause Interview Questions

The WHERE clause filters rows returned by a query. Only rows where the condition evaluates to TRUE are included in the result.

Syntax

SELECT column1, column2
FROM table_name
WHERE condition;

You can combine conditions using AND, OR, and NOT.

Example — run it and see

SELECT order_id, status, total_amount
FROM orders
WHERE status = 'delivered'
  AND total_amount > 1000
ORDER BY total_amount DESC;

Practice Questions

Q3
Find all delivered orders
Write a query to fetch all orders where the status is delivered.
Q4
Find products with stock below 30
Retrieve product_id, name, and stock for all products where stock is less than 30.
Q5
Find customers from the USA
Fetch first_name, last_name, and city of all customers from the USA.
Q6
Find high-value cancelled orders
Retrieve order_id, customer_id, and total_amount for all cancelled orders with a total above 500.