High-Value Delivered Orders
The orders table holds one row per order. status is always lowercase: pending, shipped, delivered or cancelled.
Find every order that has been delivered and whose amount is at least 500.
Return columns order_id, customer_id, amount. Order by amount descending, then order_id ascending.
Schema
CREATE TABLE orders ( order_id INTEGER PRIMARY KEY, customer_id INTEGER NOT NULL, amount REAL NOT NULL, status TEXT NOT NULL, order_date TEXT NOT NULL );
Sample data
orders
| order_id | customer_id | amount | status | order_date |
|---|---|---|---|---|
| 1 | 101 | 250 | delivered | 2026-01-03 |
| 2 | 102 | 780.5 | delivered | 2026-01-04 |
| 3 | 103 | 1200 | cancelled | 2026-01-05 |
| 4 | 101 | 640 | shipped | 2026-01-06 |
| 5 | 104 | 915.25 | delivered | 2026-01-07 |
| 6 | 105 | 499.99 | delivered | 2026-01-08 |
| 7 | 102 | 1500 | delivered | 2026-01-09 |
| 8 | 106 | 60 | pending | 2026-01-10 |
Hint 1
Both conditions go in the WHERE clause, joined with AND.
Hint 2
"At least 500" means >= 500, so an order of exactly 500 counts.
Good practice for: Data Analyst, Business Analyst, Backend Developer
SQL (SQLite)
Run checks your query on the sample data (Ctrl + '). Submit also checks hidden databases.