Skip to main content

UPDATE

Modify existing rows in a table.

Syntax

Parameters

ParameterDescription
tableThe table containing the rows to modify
column = valueColumn assignment. Each column is set to the given value or expression
WHERE conditionFilter 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
);

See also