#upsert Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
PHP UPSERT (INSERT ... ON DUPLICATE KEY UPDATE)
A MySQL upsert helper: insert a row, or if a unique key collides, update the same row with the new values. Returns whether the row was inserted (true) or updated (false).
SQL MERGE — One Statement for INSERT + UPDATE + DELETE
`MERGE` (standard SQL, PostgreSQL 15+, SQL Server, Oracle) is a single statement that combines INSERT/UPDATE/DELETE driven by joining a source against a target. Heavy artillery for reconciliation jobs.
SQL UPSERT — MySQL ON DUPLICATE KEY UPDATE
MySQL's flavor of upsert. Triggers when an INSERT would violate a PRIMARY KEY or UNIQUE constraint. Use `VALUES()` (or `NEW.col` in MySQL 8.0.20+) to reference the would-be-inserted row.
SQL UPSERT — PostgreSQL ON CONFLICT
`INSERT ... ON CONFLICT DO UPDATE` inserts a row, or updates the existing one if a unique-constraint collision happens. The atomic alternative to "SELECT, then INSERT or UPDATE".