Last updated

SQL UPDATE

Definition: UPDATE changes data in existing rows. You set new column values, and use WHERE to choose which rows to change.

Example 1 — change one customer's city

UPDATE Customers
SET City = 'Munich'
WHERE CustomerID = 1;

Example 2 — update and check the result

UPDATE Products
SET Price = 20
WHERE ProductName = 'Chais';
SELECT * FROM Products WHERE ProductName = 'Chais';

Example 3 — update several columns at once

UPDATE Customers
SET City = 'Hamburg', Age = 33
WHERE CustomerID = 1;

⚠️ Important: if you forget the WHERE clause, every row in the table is updated. Always double-check your WHERE.

Try it Yourself
Output

          
Ad · responsive