DAY_SECOND is an interval qualifier that combines the DAY, HOUR, MINUTE, and SECOND fields into a single value. You use it in functions such as DATE_ADD, DATE_SUB, TIMESTAMPADD, and TIMESTAMPDIFF (MySQL) or in ANSI/Oracle interval literals (INTERVAL 'n' DAY TO SECOND). Internally the database converts the literal string into a signed integer representing the total number of seconds, then adds or subtracts that value from the originating date-time. Precision can reach fractional seconds depending on dialect support. Because DAY_SECOND collapses multiple temporal parts into one token, it simplifies adding or subtracting mixed-unit durations without chaining multiple statements. Caveats: the literal must match the expected format ('D HH:MM:SS[.fraction]'); out-of-range components throw errors; negative values require a leading '-' sign.
expr
(string or integer) - The interval literal in 'D HH:MM:SS' or similar format depending on dialect.date_expr / timestamp_expr
(DATETIME/TIMESTAMP) - The starting point for the calculation.INTERVAL, DATE_ADD, TIMESTAMPADD, DAY_HOUR, HOUR_MINUTE, EXTRACT
SQL:1999 interval spec; MySQL 4.1
An interval with DAY_SECOND precision contains a number of days plus hours, minutes, and seconds, making it ideal for representing mixed-unit durations like "2 days 3 hours".
In MySQL you can add fractional seconds up to microsecond precision: '0 00:00:01.500' DAY_SECOND adds 1.5 seconds. Oracle allows up to 9 digits of fractional seconds.
Yes - either wrap the literal in a negative sign (INTERVAL '-1 02:00:00' DAY_SECOND) or use DATE_SUB/TIMESTAMPDIFF depending on your dialect.
The database raises an error such as "Incorrect interval value" or "invalid day-second interval literal"; nothing is executed.