About

A SQL statement that can conditionally insert, update, or delete target rows.

Officially introduced in the SQL:2003 standard, and expanded in the SQL:2008 standard, MERGE does an INSERT for new records and an UPDATE of existing records depending on whether or not a condition matches.

Database management systems such as Oracle Database, DB2, Teradata and Microsoft SQL Sever support this syntax. Some allow a DELETE action as well.

MERGE is similar to, but not synonymous with UPSERT.

history | excerpt history