SQL Server
SELECT DATEADD(DAY, 7, '2026-11-20');
No + on DATE values: DATEADD covers every unit and keeps the input's type. A string literal is read as datetime, so this returns 2026-11-27 00:00:00.000.
Five engines, five spellings of 'a week from today'.
Filed under Types & casting
PostgreSQL and Oracle read like arithmetic, MySQL and SQL Server read like function calls, and SQLite reads like a tiny language of modifiers. None of it ports without rewriting.
Adding days is the most common date arithmetic, and it is the clearest window into each engine's model: real date types add numbers directly, while text-based or function-based engines need a dedicated call.
SELECT DATEADD(DAY, 7, '2026-11-20');
No + on DATE values: DATEADD covers every unit and keeps the input's type. A string literal is read as datetime, so this returns 2026-11-27 00:00:00.000.
SELECT DATE '2026-11-20' + 7;
An integer adds days to a date; add INTERVAL '7 days' to a timestamp instead.
SELECT DATE_ADD('2026-11-20', INTERVAL 7 DAY);
INTERVAL n DAY is the general mechanism. '2026-11-20' + 7 coerces the string to the number 2026 and returns 2033.
SELECT DATE('2026-11-20', '+7 days');
Dates are text: modifiers like '+7 days' chain after the base time, e.g. DATE('now', '+7 days').
SELECT DATE '2026-11-20' + 7 FROM dual;
Adding a number to a DATE adds that many days; fractions add time (1/24 is one hour).
Yes: DATEADD(HOUR, ...) in SQL Server, INTERVAL '7 hours' in PostgreSQL, INTERVAL 7 HOUR in MySQL, '+7 hours' in SQLite, and fractions of a day in Oracle (DATE + 4.5/24).
In numeric context MySQL reads the string's leading number, 2026, and returns 2033 with a warning. A real DATE fares no better: DATE '2026-11-20' + 7 is 20261127. Date arithmetic goes through DATE_ADD/DATE_SUB or + INTERVAL.
PostgreSQL's timestamptz does: adding INTERVAL '1 day' across a DST change keeps the wall-clock time, while INTERVAL '24 hours' adds exactly 24 hours. SQL Server's DATEADD on datetimeoffset keeps the offset fixed, and naive date and timestamp types everywhere just add calendar days.
Jan 31 plus one month is Feb 28 in four engines, Mar 3 in SQLite, and an error with Oracle's INTERVAL form.
Two engines have real interval types; three fake it with functions and modifiers.
Named zones versus fixed offsets, and which engines know the difference at all.
SQLly is a native SQL workbench for macOS, Windows and Linux. Its formatter and plan viewer work in all five dialects.