Best April deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Dealing with dates
Working with time
Date and time data types in PostgreSQL
Extracting dates and times
26. DATE_PART() with the wrong data type – continued
Timezone conversion
Format date and time
Current date and time data
Summary

Instruction

Error! That's what you got, as you probably expected. It's not possible to extract part of date from a time column... But it's possible to extract a field of time from a date column. It will just provide a zero. Let's give it a try.

Exercise

For each flight, show its id, flight_date, and month extracted from the flight_date column as the month column.

Stuck? Here's a hint!

Syntax reminder:

SELECT DATE_PART('year', launched_timestamp) AS year
FROM aircraft;

Be sure to name the column month.