Databases & SQL vocabulary · SQL Statements and Queries

Upsert

Meaning in databases & SQL, with examples

/ˈʌpsɜːrt/verbCommon term

In databases & SQL, upsert means: To insert a row if it does not exist yet, or update it if it already does, in a single operation. The word combines 'update' and 'insert'.

In Turkish: varsa güncelleyip yoksa eklemek, upsert etmek

How it is used

Also a noun: 'do an upsert'. Syntax differs: INSERT ... ON CONFLICT DO UPDATE in PostgreSQL and SQLite, INSERT ... ON DUPLICATE KEY UPDATE in MySQL, and MERGE in SQL Server and Oracle. It needs a unique key to decide whether the row exists.

Example sentences

  1. The sync job upserts products by SKU, so running it twice is safe.

  2. Use an upsert instead of checking first and then inserting; that check can race.

Common collocations

  • upsert a row
  • ON CONFLICT DO UPDATE
  • MERGE statement
  • upsert by key

This word in other fields

The same English word can have a different meaning in another field:

More terms: SQL Statements and Queries

Practise with graded reading

Reading at the right level is the fastest way to make new words stick. Pick free English books by level: