HOUR_SECOND is a MySQL-specific interval unit that treats hours, minutes, and seconds as a single composite value. It is accepted anywhere an INTERVAL unit is expected, including DATE_ADD, DATE_SUB, TIMESTAMPDIFF, TIMESTAMPADD (MariaDB), EXTRACT, and arithmetic using the + or - operators. The literal interval value can be written in either 'HH:MM:SS' (colon-separated) or HHMMSS (numeric) format and may include a leading sign. Internally, MySQL converts the supplied text or integer to seconds, performs the requested calculation, and then returns a properly typed DATE, DATETIME, or TIME result depending on the expression. Because the value is parsed as a whole, you cannot omit any component; every literal must include hours, minutes, and seconds. When used with EXTRACT, MySQL returns an integer formatted as HHMMSS (for example, 142338 for 14:23:38). HOUR_SECOND is not part of the ANSI SQL standard and is therefore unavailable in PostgreSQL, SQL Server, Oracle, or SQLite.
date_or_datetime
(DATETIME/DATE) - The value to add to, subtract from, or extract parts of.expr
(STRING or INT) - Interval literal in 'HH|||MM|||SS' or HHMMSS format; may be signed.datetime
(DATETIME) - Value passed to EXTRACT to retrieve the HHMMSS integer.INTERVAL, MINUTE_SECOND, HOUR_MINUTE, DAY_SECOND, DATE_ADD, DATE_SUB, EXTRACT
MySQL 4.1
Use HOUR_SECOND with a single INTERVAL expression:```SELECT start_time + INTERVAL '01:45:30' HOUR_SECOND;```
'HH:MM:SS' (quoted string) or HHMMSS (numeric). Both may be signed.
No. It is available only in MySQL and MariaDB. Use separate INTERVAL units or database-specific syntax elsewhere.
Yes. Prefix the literal with a minus sign to subtract the composite interval.