Skip to content
Aabha AI Academy
Skip to reading

SQL

04 Dates

-- 04_dates: Create a month key and age in days
-- Read-only reference query. Setup must be loaded first.
SELECT order_id, date_trunc('month',order_date)::date::text AS order_month,
 DATE '2025-04-01' - order_date AS days_before_cutoff
FROM aabha_sql.orders WHERE order_id IN (1001,1004,1012)
ORDER BY order_id;

Download this source file