Finance wants revenue for all four quarters side-by-side in a single row per year. Using the orders table, return year, q1, q2, q3, and q4 (each is the total revenue for that quarter), ordered by year. Quarters with no orders should show 0.
orders
| column | type |
|---|---|
| id | INTEGER |
| customer_id | INTEGER |
| amount | NUMERIC |
| created_at | DATE |
| id | customer_id | amount | created_at |
|---|---|---|---|
| 1 | 1 | 100 | 2024-01-15 |
| 2 | 2 | 200 | 2024-04-10 |
| 3 | 1 | 150 | 2024-07-20 |
| 4 | 3 | 300 | 2024-10-05 |
| 5 | 2 | 250 | 2024-02-28 |
| year | q1 | q2 | q3 | q4 |
|---|---|---|---|---|
| 2024 | 350 | 200 | 150 | 300 |