SQL runs locally in a Web Worker using SQLite through the existing Pyodide runtime. Only read operations are allowed; each run starts with fresh data. Results are limited to 200 rows and execution is bounded. No server executes your SQL.
Exercise 1 / 12
Read the order book
Return order_id and amount for all orders, ordered by order_id.
Expected result
| order_id | amount |
|---|---|
| 101 | 120 |
| 102 | 500 |
| 103 | 80 |
| 104 | 200 |
| 105 | 300 |
| 106 | 100 |
Column names and order must match. Row order is ignored; duplicate rows still count.
Schema & seed data
customers.customer_id → orders.customer_id; orders.order_id → returns.order_id. A return can be partial; pending refunds have NULL days_to_refund. SQL uses SQLite syntax.
customers (5 rows)
customer_id INTEGER · name TEXT · segment TEXT
| customer_id | name | segment |
|---|---|---|
| 1 | Asha | Retail |
| 2 | Ben | Corporate |
| 3 | Chen | Retail |
| 4 | Dina | Corporate |
| 5 | Eli | Retail |
orders (6 rows)
order_id INTEGER · customer_id INTEGER · amount REAL · ordered_at TEXT
| order_id | customer_id | amount | ordered_at |
|---|---|---|---|
| 101 | 1 | 120 | 2026-01-05 |
| 102 | 2 | 500 | 2026-01-10 |
| 103 | 1 | 80 | 2026-02-01 |
| 104 | 3 | 200 | 2026-02-08 |
| 105 | 4 | 300 | 2026-02-12 |
| 106 | 2 | 100 | 2026-02-18 |
returns (5 rows)
return_id INTEGER · order_id INTEGER · reason TEXT · refund REAL · days_to_refund INTEGER · status TEXT
| return_id | order_id | reason | refund | days_to_refund | status |
|---|---|---|---|---|---|
| 1 | 101 | Damaged | 120 | 3 | Paid |
| 2 | 102 | Wrong item | 250 | 7 | Paid |
| 3 | 104 | Damaged | 200 | NULL | Pending |
| 4 | 105 | Changed mind | 100 | 5 | Paid |
| 5 | 106 | Damaged | 100 | 2 | Paid |