Eine Einführung in

SQL

Subtract dates

DB2
SQL Standard allows dates to be subtracted. We specify the unit and the number of digits of the result answer: YEAR MONTH DAY HOUR MINUTE SECOND

We want to know how long has it been since Tom Jones featured on TOTP.



Specific to DB2
The DAYS function gives us the number of days since a long time ago. The string "yymmdd" includes the number of years, months and days since.