Upsert

SQL

SQL - MERGE / UPSERT Statement

MERGE statements solve a common data synchronization problem: you need to insert a row if it doesn’t exist, or update it if it does. The naive approach—checking existence with SELECT, then branching…

Read more →
SQLite

How to Use UPSERT in SQLite

UPSERT is a portmanteau of ‘UPDATE’ and ‘INSERT’ that describes an atomic operation: attempt to insert a row, but if it conflicts with an existing row (based on a unique constraint), update that row…

Read more →