D8LooPFocus modeCODE WORKSPACE
Return order_id, status, and total_amount for orders that are paid or shipped, were created in January 2026, and have total_amount of at least 100. Order by order_id.
Filter on status IN ('paid','shipped'), a half-open January range on created_at, and total_amount >= 100, then ORDER BY order_id.
Sample input
| order_id | status | total_amount | created_at |
|---|---|---|---|
| 1001 | paid | 80 | 2026-01-12 08:40:00 |
| 1002 | paid | 120 | 2026-01-12 10:02:00 |
| 1003 | pending | 40 | 2026-01-13 11:15:00 |
| 1004 | shipped | 220 | 2026-01-15 14:20:00 |
| 1005 | paid | 540 | 2026-01-18 09:05:00 |
| 1008 | shipped | 150 | 2026-01-25 12:00:00 |
| 1010 | paid | 640 | 2026-01-30 21:10:00 |
| 1011 | paid | 110 | 2026-02-02 09:00:00 |
Expected output
| order_id | status | total_amount |
|---|---|---|
| 1002 | paid | 120 |
| 1004 | shipped | 220 |
| 1005 | paid | 540 |
| 1008 | shipped | 150 |
| 1010 | paid | 640 |
Constraints
Use IN for the status set. Use a half-open date range (created_at >= '2026-01-01' AND created_at < '2026-02-01') so the February orders are excluded. Keep the status set grouped so precedence is unambiguous.
Expected skills
Membership filters with IN, half-open date ranges on text timestamps, and combining AND conditions without precedence bugs.
Run the SQL query to inspect preview rows.