Back to Practice
#0311
Filter Paid Orders Above a Minimum
EasySQL15 min10 XP
Problem
Return order_id and amount for paid orders with amount at least 100, ordered by order_id.
Why This Matters
SQL interviews usually test whether you can turn a business question into the right rows, grouping level, join type, and edge-case behavior.
Schema
orders(order_id INTEGER, status TEXT, amount INTEGER)
Examples
Example 1
Inputorders with paid, cancelled, and different amounts
Outputorders 2 and 4
Only paid rows with amount >= 100 are kept.
Constraints
- Return only the requested columns.
- Use deterministic ORDER BY when multiple rows are returned.
- Assume SQLite-compatible SQL unless the prompt states otherwise.
CodeSQL
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core SQL case
Inputorders with paid, cancelled, and different amounts
Expected[[2,120],[4,100]]
Only paid rows with amount >= 100 are kept.
Hidden Test Categories
Empty or missing matchesDuplicate rows or tiesNULL values where the pattern commonly breaks