Introduction
Dates
Time
Timestamps
Extract functions
25. EXTRACT with a wrong data type – continued
Timezone conversion
Intervals
Current date and time
Revision

Instruction

Error! That's what you got, as you could have expected. It's not possible no extract any 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, date and the hour extracted from the field date (name the column hour).

Stuck? Here's a hint!

Syntax reminder:

SELECT EXTRACT(YEAR FROM launched) AS year
FROM aircraft;

 

Console

Code editor

Result

TableConsole