This page is part of the book SQL-99 Complete, Really, by Peter Gulutzan & Trudy Pelzer. The authors have graciously allowed us to reproduce the contents of the book here. Because the book is about the SQL-99 standard, the contents of this and other pages in the book may not directly apply to MariaDB. Use the navigation bar to navigate the book.

In SQL, a temporal value is either a datetime (i.e.: a date, a clock time or a timestamp) or an interval (i.e.: a span of time). They consist of a contiguous subset of one or more of the datetime fields (in their order of significance): YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, TIMEZONE_HOUR and TIMEZONE_MINUTE. A temporal value may be a <literal>, the value of a parameter or a host language variable or the result of any expression or argument (including a possibly qualified <Column name>) that evaluates to a date, a time, a timestamp or an interval. Temporal values are constrained by their datetime fields and must obey the natural rules for dates and times according to the Gregorian calendar.

Datetimes are either dates, times or timestamps. Dates are stored in the DATE <data type>, times are stored in either the TIME or the TIME WITH TIME ZONE <data type>s and timestamps are stored in either the TIMESTAMP or the TIMESTAMP WITH TIME ZONE <data type>s.

Intervals are either year-month intervals (spans of time involving years and/or months) or day-time intervals (spans of time involving days and/or hours and/or minutes and/or seconds and/or fractions of a second); they include a qualifier which specifies which of the datetime fields are represented in the interval. All interval values are signed. Intervals are stored in the INTERVAL <data type>.