Search RU
Tasks / SQL / Orders by month
Statement medium

Orders by month

`monthly_totals(conn)` groups orders by month.

```sql
CREATE TABLE orders (amount REAL, created_at TEXT)
```

Result: `[{"month": "YYYY-MM", "total": number}]`, sorted by month. Orders with
`created_at IS NULL` are excluded.

Write tests: two months, a NULL date, an empty table.

sqldatesgrouping
test_solution.py Python 3.14
AI mentor

The AI mentor is available after you log in: it sees your attempt history and does not spend resources on anonymous requests.

Log in and ask
Hints 1 of 3 unlocked · attempts: 0
Hint 1

What should happen to a record with a NULL date? It belongs to no month — check
that with a dedicated test.

Hint 2 — unlocks after 1 attempt
Hint 3 — unlocks after 3 attempts