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.
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.
Learning SQL in order?
Use the roadmap to follow each SQL topic step by step, from relational database basics to advanced query techniques.
Back to SQL RoadmapRelated lessons
ALTER TABLE
A beginner-friendly guide to ALTER TABLE in SQL, including how to add, change, and remove columns from an existing table.
CREATE TABLE
A beginner-friendly guide to the SQL CREATE TABLE statement, including table planning, column names, data types, and a SQL Server-friendly example.
DELETE
A beginner-friendly guide to the SQL DELETE statement, with SQL Server-friendly examples for removing rows from a table safely.