Functions, Dates and Cleaning · Problem 25 of 118

Joined in the Last Quarter

MediumFunctions, Dates and CleaningShop data

Return the customer_id, first_name and joined_on of every customer who joined in the fourth quarter of 2025 (October, November or December).

Hint 1

A range test on the text date is enough: from '2025-10-01' up to and including '2025-12-31'.

Reference solution

SELECT customer_id, first_name, joined_on
FROM customers
WHERE joined_on BETWEEN '2025-10-01' AND '2025-12-31';

A range on the whole date is usually the best way to filter by period: it is simple, it is correct, and (in a real database) it lets an index on the date column help. Wrapping the column in a function (STRFTIME(...)) works too but hides the column from indexes.

Another way. Extract the parts of the date and test them.

SELECT customer_id, first_name, joined_on
FROM customers
WHERE STRFTIME('%Y', joined_on) = '2025'
  AND CAST(STRFTIME('%m', joined_on) AS INTEGER) >= 10;