Date range filters show up in almost every financial report. Suppose that you're a Google data analyst and need to query Feb-March 2024 data to prep a revenue breakdown for a quarterly review. Using the orders table, return id, customer_id, amount, and created_at for orders where created_at is between 2024-02-01 and 2024-03-31 (inclusive), ordered by date.
orders
| column | type |
|---|---|
| id | INTEGER |
| customer_id | INTEGER |
| amount | NUMERIC |
| created_at | DATE |
| id | customer_id | amount | created_at |
|---|---|---|---|
| 1 | 1 | 120.00 | 2024-01-15 |
| 2 | 2 | 45.50 | 2024-02-03 |
| 3 | 1 | 300.00 | 2024-02-28 |
| 4 | 3 | 75.00 | 2024-03-10 |
| 5 | 2 | 200.00 | 2024-04-01 |
| id | customer_id | amount | created_at |
|---|---|---|---|
| 2 | 2 | 45.50 | 2024-02-03 |
| 3 | 1 | 300.00 | 2024-02-28 |
| 4 | 3 | 75.00 | 2024-03-10 |