Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
18. Timestamps with constant values
Extract functions
Timezone conversion
Current date and time


We detected a mistake in the table, thank you for your help.

Timestamps are a very precise way to define a point in time. This is why using the equality sign (=) with them isn't a good idea. Two timestamps may differ by a single second and the condition on equality will not be satisfied. Still, you can use comparisons with >, <, != etc. to compare two columns (just as you did) or a column with a constant value. Do we have to be very precise when providing the constant value? Not really. Take a look:

SELECT id, launched
FROM flight
WHERE launched > '2015-01-01';

As you can see, we compared a timestamp with a date. How is it possible? Well, our database converts the date we provided to a timestamp by adding as many zeroes as necessary. For instance:

  • '2015-01-01' will become '2015-01-01 00:00:00',
  • '2014-02-12 12:00' will become '2014-02-12 12:00:00'.

Convenient, isn't it?


Identify the id and withdrawn date for all the aircraft withdrawn after October 15, 2015.

Stuck? Here's a hint!

Remember about the proper date format and use apostrophes: 'YYYY-MM-DD'.