Introduction
Dates
6. Date format explained
Time
Timestamps
Extract functions
Timezone conversion
Intervals
Current date and time
Revision

Instruction

Good. As you could see, dates are shown in the following format: YYYY-MM-DD. First we provide the year, then the month, finally the day. Be aware, though, that some databases may use other formats, depending on the database configuration. If we want to use dates in our queries, in turn, we need to provide them in apostrophes:

SELECT id, model
FROM aircraft
WHERE produced = '2012-04-05';

The above query will select the id and model of all the aircraft produced on April 5, 2012.

Exercise

Select the columns id, model and produced for those aircraft which were produced on April 6, 2008 or March 1, 2010.

Stuck? Here's a hint!

You will need two conditions joined with OR. Remember about the proper date format and use apostrophes: 'YYYY-MM-DD'.

Console

Code editor

Result

TableConsole