Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Dates
Time
Timestamps
17. Timestamps explained
Extract functions
Timezone conversion
Current date and time
Review

Instruction

Good. Did you take a look at the format? Let's analyze it:

'2014-06-10 07:55:00+02'

The first part is, of course, the date, and the second part is time. The final '+02' refers to the timezone - in this case it means that we are two hours ahead of UTC. The timestamp format depends on database configuration.

You can compare two timestamp columns, just like this:

SELECT id
FROM aircraft
WHERE withdrawn < launched;

The above query could be used to check for typos in our table – this way, we can make sure there is no aircraft which was withdrawn from service before it was even launched.

Exercise

Run the template query and find out for yourself whether there are erroneous entries in the table aircraft.