UPDATE
Modify existing rows in a table.
Syntax
Parameters
| Parameter | Description |
|---|---|
| table | The table containing the rows to modify |
| column = value | Column assignment. Each column is set to the given value or expression |
WHERE condition | Filter which rows to update. Without WHERE, all rows are updated |
Examples
Basic update
UPDATE employees
SET salary = 135000
WHERE id = 3;
Update multiple columns
UPDATE orders
SET status = 'shipped', shipped_at = NOW()
WHERE status = 'processing' AND created_at < '2025-03-01';
Update from subquery
UPDATE employees
SET salary = salary * 1.10
WHERE department IN (
SELECT department
FROM performance_reviews
WHERE avg_score > 4.5
);