Loading Data Driven Insights
Preparing your learning content.
Preparing your learning content.
A beginner-friendly guide to the SQL UPDATE statement, with SQL Server-friendly examples for changing existing values inside a table.
On this page
Jump to a lesson section
The UPDATE statement is used to change existing values inside a table.
You can use UPDATE when you want to update one row, update multiple rows, change one column value, change multiple column values, or correct existing records.
A basic UPDATE statement names the table, sets the new value, and uses a WHERE condition to control which row should be updated.
UPDATE table_name
SET column_name = new_value
WHERE condition;
UPDATE Employees
SET salary = 47000
WHERE employee_id = 6;
employee_id = 6.We will update Ethan Moore’s salary from 45000 to 47000.
This query updates only one row because the WHERE condition matches one employee.
UPDATE Employees
SET salary = 47000
WHERE employee_id = 6;
This query updates only one row because the WHERE condition matches one employee.
Without WHERE, SQL may update every row in the table.
UPDATE Employees
SET salary = 47000;
UPDATE Employees
SET salary = 47000
WHERE employee_id = 6;
UPDATE changes existing data in a table. Always use a clear WHERE condition when you only want to update specific rows.
UPDATE is a DML command used to change existing values in a table. Use WHERE carefully so SQL updates only the rows you intend to change.
SQL Roadmap Progress
Topic 24 of 111
22% complete
Next in SQL Roadmap
Continue with the next SQL topic in the recommended roadmap order.
Continue learning →