Practice: Busy Seasons
Dates in real questions.
Helen wants to plan staff for next Christmas. How many real orders came in last December? A real order means one that wasn't cancelled.

- Planning for Christmas
- Orders last December
- Not counting cancellations
December orders
We combine a date range with a status test. Between the first and the thirty first of December, and status is not cancelled. Run it. Eighty eight real orders in December. That's one of Helen's busier months, so she'll want extra help.
SELECT COUNT(*) AS december_orders
FROM orders
WHERE order_date BETWEEN '2025-12-01' AND '2025-12-31'
AND status <> 'cancelled';โโโโโโโโโโโโโโโโโโโ โ december_orders โ โโโโโโโโโโโโโโโโโโโค โ 88 โ โโโโโโโโโโโโโโโโโโโ
Returns in February
Your turn. Find every order from February twenty twenty five that was returned. Show the order ID, the date, and the status. Pause and try it. Here's one solution. The month is zero two, the year is twenty twenty five, and the status is returned.
Orders from February 2025 with status 'returned'
Show hint
strftime('%m', ...) = '02' and strftime('%Y', ...) = '2025'
Show solution
SELECT order_id, order_date, status
FROM orders
WHERE strftime('%m', order_date) = '02'
AND strftime('%Y', order_date) = '2025'
AND status = 'returned';โโโโโโโโโโโโฌโโโโโโโโโโโโโฌโโโโโโโโโโโ โ order_id โ order_date โ status โ โโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโค โ 2071 โ 2025-02-09 โ returned โ โ 2152 โ 2025-02-14 โ returned โ โ 2546 โ 2025-02-26 โ returned โ โโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโโ
Quick check
Quick check. Which of these finds orders in March twenty twenty five? Pause and choose. The answer is C. Both ends of the range are included, so the first and the thirty first of March are counted. Option A would miss most of the month.
Summary
Dates are no longer scary. You can filter, split, add, and count them. You've finished the functions module! Next, the moment SQL becomes truly powerful. Counting and adding up.
Key takeaways- Date ranges with BETWEEN
- Parts with strftime
- Combine with AND