87. Orders in the Last 30 Days
To find rows within the last N days of a reference point, compare the date against date(reference, '-N days'). Anything >= that boundary (and <= the reference) is inside the window.
Use a fixed reference date of '2024-06-15' so the answer is stable, and a 30-day window.
Task: return id, order_date, and days_ago (whole days between order_date and '2024-06-15') for orders placed in the last 30 days up to and including '2024-06-15' — that is, with order_date between '2024-05-16' and '2024-06-15' inclusive. Order by order_date.
Output columns, in order: id, order_date, days_ago.
This is the result for the example data above. On Submit your query is graded against this example plus 4 hidden edge cases — 5test cases in all. A sloppy query that only fits the example won't pass.