SQL UPDATE Statement (original) (raw)

Last Updated : 9 Feb, 2026

The SQL UPDATE statement is used to modify existing data in a table by changing the values of one or more columns.

**Example: First, we will create a demo SQL database and table, on which we will use the UPDATE Statement command.

Screenshot-2026-01-13-162047

**Query:

UPDATE Employees SET Salary = 65000 WHERE Name = 'Daniel';

Screenshot-2026-01-13-162133

**Syntax:

UPDATE table_name SET column1 = value1, column2 = value2,...  WHERE condition;

**Note: The SET keyword assigns new values to columns, while the WHERE clause selects which rows to update. Without WHERE, all rows will be updated.

Working with the UPDATE Statement

Consider the Customer table shown below, which contains each customer’s unique ID, name, last name, phone number, and country. This table will be used to demonstrate how the SQL UPDATE statement works.

Screenshot-2026-02-09-102451

Customer Table

Example 1: Update Single Column

We have a Customer table and we want to update the Age to 25 for the customer whose CustomerName is 'Isabella'.

**Query:

UPDATE Customer SET Age = 25 WHERE CustomerName = 'Isabella';

SELECT * FROM customer;

**Output:

Screenshot-2026-02-09-102706

Example 2: Updating Multiple Columns

We need to update both the CustomerName and Country for a specific CustomerID.

**Query:

UPDATE Customer SET CustomerName = 'John', Country = 'Spain' WHERE CustomerID = 1;

**Output:

Screenshot-2026-01-13-163720

**Note: For updating multiple columns we have used comma(,) to separate the names and values of two columns.

Example 3: Omitting WHERE Clause in UPDATE Statement

If we accidentally omit the WHERE clause, all the rows in the table will be updated, which is a common mistake. Let’s update the CustomerName for every record in the table:

**Query:

UPDATE Customer SET CustomerName = 'Mike';

SELECT * FROM customer;

**Output:

Screenshot-2026-01-13-164126