Tag archive
Commands grouped around the same concept, pattern, or recurring problem.
Define a column default so inserts can omit routine values and still store a complete row.
Add new data to a table, then verify the inserted row with a deterministic query.
Add several rows in one statement using a multi-value `INSERT`.
Atomically insert a row if it does not exist or update it if it does, using the database's native conflict-resolution syntax.
Insert rows without raising an error when a unique constraint is violated, using each engine's conflict-ignore syntax.
Populate a table by selecting rows from another table using `INSERT INTO ... SELECT`.
Get the affected rows back in the same statement — using `RETURNING` in PostgreSQL, MariaDB, and SQLite, or `OUTPUT` in SQL Server.
Use `MERGE` to insert new rows, update matching ones, and delete rows that should be removed — all in a single statement against a source table.