BasicsBETWEENDatesGoogleAmazonMeta
Table
orders(order_id INT, order_date VARCHAR)
Task
From orders(order_id, order_date) (ISO 'YYYY-MM-DD' strings), return order_id, order_date for orders placed in calendar year 2025 ('2025-01-01' through '2025-12-31' inclusive), ordered by order_id ASC.
Why It Matters: BETWEEN simplifies inclusive date-window filtering for monthly, quarterly, and campaign-period analytics.
Output columns: order_id, order_date
Example
Input — orders
| order_id | order_date |
|---|---|
| 1 | 2024-12-31 |
| 2 | 2025-01-01 |
| 3 | 2025-06-15 |
| 4 | 2025-12-31 |
| 5 | 2026-01-01 |
Expected Output
| order_id | order_date |
|---|---|
| 2 | 2025-01-01 |
| 3 | 2025-06-15 |
| 4 | 2025-12-31 |
Explanation: Keeps all orders whose date falls inclusively within the start and end bounds.
Requirements
- Exact output columns:
order_id,order_date - Row order: Exact
ORDER BYorder is checked by the grader. - Query type: Write a single read-only Standard SQL
SELECT(orWITH ... SELECT) query.
Constraints & Evaluation Criteria
- Return `order_id, order_date` ordered by `order_id ASC`.
Hints
SQL⌘/Ctrl+Enter to Run · ⌘/Ctrl+Shift+Enter to Submit
Loading Code Editor...
+1 Hidden Submit Case
Input / Scenario
orders (5 rows)
Expected Output / Criteria
3 row(s): (2, 2025-01-01); (3, 2025-06-15); (4, 2025-12-31)