~/ learn/ postgresql/ cards/ Dates & time
1 of 2

For each order show id, ordered_at, and the year (yr) and month (mo) it was placed, using EXTRACT.

For each order show id, ordered_at, and the year (yr) and month (mo) it was placed, using EXTRACT.

Answer

SELECT id, ordered_at, EXTRACT(YEAR FROM ordered_at) AS yr, EXTRACT(MONTH FROM ordered_at) AS mo FROM orders;

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/0e49a667-5da4-4607-b77c-d364578918bc/flashcard utf-8 LF