Skip to content
Aabha AI Academy
Skip to reading

SQL · Module 3

Answers and explanations · Filter rows without losing the unknowns

Compare these references after your own attempt. You can read them at any time; they do not record a live model or vendor run.

Exercise 03a

Order 1007 is pending and falls inside February. Cancelled orders elsewhere in the quarter are outside this question.

SELECT order_id,status FROM aabha_sql.orders WHERE status<>'completed'
 AND order_date>=DATE '2025-02-01' AND order_date<DATE '2025-03-01' ORDER BY order_id;

Expected output:

order_id status
1007 pending

Runnable answer: sql/solutions/03a.sql

Exercise 03b

Customers 1, 4 and 8 are in Pune; customer 6 has an unknown city. IS NULL includes the unknown case deliberately.

SELECT customer_id,customer_name FROM aabha_sql.customers
WHERE city='Pune' OR city IS NULL ORDER BY customer_id;

Expected output:

customer_id customer_name
1 Asha
4 Divya
6 Farah
8 Hari

Runnable answer: sql/solutions/03b.sql

Return to this module