Fantastic job! It's time to review what we know about date and time.
- SQL features dates (
'2010-01-01'), times (
'13:00:00') and timestamps (
- You can compare the above types, use
ORDER BY with them.
- The function
EXTRACT(DAY FROM column) extracts certain parts of date/time.
AT TIME ZONE switches between time zones.
INTERVAL '7' DAY is an interval of 7 days which you can add to or subtract from a timestamp/date.
INTERVAL '2-1' YEAR TO MONTH is another type of interval, this one is an interval of 2 years and 1 month.
- For current date and time, you can use
Are you ready to practice?