UPDATE changes data that already exists in a table. You specify the target table, list one or more columns to set, and optionally filter which rows are affected with a WHERE clause. Without a WHERE clause, every row in the table is updated, so use it carefully. Most dialects support joins in an UPDATE or allow a subquery in the SET list. Some engines also return the modified rows via RETURNING. UPDATE runs inside a transaction, so it can be rolled back if an error occurs or if you call ROLLBACK. Concurrency controls such as row-level locks ensure data integrity while the statement executes.
table_name
(identifier) - Target table to modifycolumn
(identifier) - One or more columns to updatevalue
(expression) - New value or expression to assigncondition
(boolean) - Filters rows to update (optional)ONLY
(keyword) - In PostgreSQL, skip child tables (optional)FROM
(clause) - Join additional tables for reference (dialect specific)RETURNING
(clause) - Return modified rows (PostgreSQL, SQLite, etc.)SQL-86 (SQL-1)
Omit the WHERE clause entirely: `UPDATE table_name SET column = value;` Be sure this is intentional because the change cannot be scoped later.
Yes in many dialects. PostgreSQL uses `FROM`, SQL Server uses `JOIN` syntax inside UPDATE, and MySQL supports multi-table UPDATE.
Always include a WHERE clause or run inside a transaction and check the affected row count before COMMIT.
Most engines place row-level locks on the affected rows, not the full table, unless an index is missing or the optimizer escalates the lock.