PostgreSQL DATEADD() Equivalent

Updated 20 April 2024 to include the date_add() function.

SQL Server has its DATEADD() function that adds an interval to a date value. MySQL’s DATE_ADD() and ADDDATE() for does the same thing, as does MariaDB’s DATE_ADD() and ADDDATE(). SQLite has a DATE() function that also provides the option of adding an interval to a given date.

Prior to version 16, PostgreSQL didn’t have a DATEADD() or equivalent function. But with PostgreSQL 16 came with the introduction of the date_add() function, which allows us to add an interval to a timestamp with time zone.

We can also add and subtract values from dates with date/time operators such as + and -.

Read more

SQLite INTERSECT Operator

In SQLite, the INTERSECT operator is used to create a compound SELECT statement that returns the intersection of the results of the left and right SELECT statements. In other words, it combines two queries, but returns only those rows that are returned in both queries.

Read more

MySQL TABLE Statement

In MySQL, the TABLE statement returns rows and columns of the given table.

The TABLE statement is similar to the SELECT statement, and it can be used as a kind of shorthand version of the SELECT statement.

The TABLE statement was introduced in MySQL 8.0.19.

Read more

VALUES Statement in MySQL

In MySQL, the VALUES statement returns a set of one or more rows as a table. Basically, it’s a table value constructor in accordance with the SQL standard, which also functions as a standalone SQL statement.

The VALUES statement was introduced in MySQL 8.0.19.

Read more