Select, Filter and Sort · Problem 5 of 118

Orders in March 2025

EasySelect, Filter and SortShop data

Finance is closing the books for March 2025.

Return the order_id, order_date and status of every order placed from 1 March 2025 to 31 March 2025, both days included.

Hint 1

Dates are stored as text in the form YYYY-MM-DD, which sorts in date order. BETWEEN includes both ends.

Reference solution

SELECT order_id, order_date, status
FROM orders
WHERE order_date BETWEEN '2025-03-01' AND '2025-03-31';

Because ISO dates (YYYY-MM-DD) are text that sorts like dates, you can compare them with BETWEEN or with >= and <. BETWEEN a AND b includes both ends. The half-open form >= start AND < next_start is safer when values may carry a time (2025-03-31 18:30), because BETWEEN ... AND '2025-03-31' would then miss that evening.

Another way. Many analysts prefer a half-open range (start included, end excluded). It stays correct even when a column also holds times of day.

SELECT order_id, order_date, status
FROM orders
WHERE order_date >= '2025-03-01' AND order_date < '2025-04-01';