What does upsert mean?

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.

ˈʌpsɜːrtverbCommon term

Databases & SQL vocabulary · SQL Statements and Queries

The word combines 'update' and 'insert'.

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

Also used in: Software Engineering

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

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: