MediumFunctions, Dates and CleaningShop dataSolved
Return the order_id and order_date of every order placed on a Sunday during January 2026.
Hint 1
STRFTIME('%w', date) gives the weekday as a number: 0 is Sunday, 1 is Monday, and so on.
Hint 2
Combine the weekday test with a date range for January.
Reference solution
SELECT order_id, order_date
FROM orders
WHERE order_date BETWEEN '2026-01-01' AND '2026-01-31'
AND STRFTIME('%w', order_date) = '0';
STRFTIME formats a date and can also extract parts of it: '%Y' year, '%m' month, '%d' day, '%w' weekday (0 = Sunday). Note that it returns text, so compare it with '0', not 0. Date functions differ a lot between databases (EXTRACT, DATE_PART, DAYOFWEEK...), but the ideas are identical.