Upsert Operation

From GM-RKB
(Redirected from Upsert)
Jump to navigation Jump to search

An Upsert Operation is database operation that inserts a record to a table if the record does not exist or, if the record already exists, updates the existing record.



References

2020

  • (Wikipedia, 2020) ⇒ https://en.wikipedia.org/wiki/Merge_(SQL)#upsert Retrieved:2020-3-2.
    • Some database implementations adopted the term "Upsert" (a portmanteau of update and insert) to a database statement, or combination of statements, that inserts a record to a table in a database if the record does not exist or, if the record already exists, updates the existing record. This synonym is used in PostgreSQL (v9.5+)[1] and SQLite (v3.24+).[2] It is also used to abbreviate the "MERGE" equivalent pseudo-code. ... The SQL:2003 defines a MERGE statement that provides similar functionality. In MySQL, UPSERT operations are carried out with the INSERT ... ON DUPLICATE KEY UPDATE (where the row is updated if already inserted) syntax. Frequently, database operations are performed in a context where multiple agents can perform queries on the same database. If the DBMS does not natively support a version of UPSERT/MERGE, the operation should be wrapped in a transaction to guarantee isolation and atomicity.

  1. PostgreSQL-tutorial
  2. upsert sqlite.org visited 6-6-2018