Upsert

From Wikipedia, the free encyclopedia

The SQL-like UPSERT statement inserts a record to a table in a database if the record does not exist; if the record already exists, an update operation is performed. This is not a standard SQL statement, but it is frequently used to abbreviate the equivalent pseudo-code. The term upsert is a portmanteau of update and insert and is common slang among database developers. The SQL:2003 defines a MERGE statement that provides similar functionality.

[edit] Example

IF FOUND
   THEN UPDATE
ELSE
   INSERT;

[edit] See also