MySQL Tutorial/Data Types/INTERVAL — различия между версиями

Материал из SQL эксперт
Перейти к: навигация, поиск
м (1 версия)
 
м (1 версия)
 
(нет различий)

Текущая версия на 12:53, 26 мая 2010

INTERVAL value Type

Adds the value to the date argument. The word INTERVAL is a keyword and must be used in the function. The Type can be one of the types shown in Table B.1.

Type Expected Value SECOND SECONDS MINUTE MINUTES HOUR HOURS DAY DAYS MONTH MONTHS YEAR YEARS MINUTE_SECOND "MINUTES:SECONDS" HOUR_MINUTE "HOURS:MINUTES" DAY_HOUR "DAYS HOURS" YEAR_MONTH "YEARS-MONTHS" HOUR_SECOND "HOURS:MINUTES:SECONDS" DAY_MINUTE "DAYS HOURS:MINUTES" DAY_SECOND "DAYS HOURS:MINUTES:SECONDS"

If you use one of the types in the first column, the value must match the format in the second column. See DATE_SUB().



   <source lang="sql">

SELECT DATE_ADD("2000-01-27", INTERVAL 4 DAY) SELECT DATE_ADD("2000-04-23 23:59:59", INTERVAL "1:1" MINUTE_SECOND)</source>