← Back to SQL Documentation

UPDATE Statement

The UPDATE statement is used to modify existing records in a table. You can update a single record or multiple records based on a specified condition.

Syntax

The basic syntax for the UPDATE statement is as follows:


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

Parameters:

Examples

Example 1: Updating a Single Record

Suppose we have a table named Employees with columns EmployeeID, FirstName, LastName, and Salary. To increase the salary of the employee with EmployeeID = 101:


UPDATE Employees
SET Salary = 65000
WHERE EmployeeID = 101;
        

Example 2: Updating Multiple Records

To give a 10% raise to all employees in the 'Sales' department:


UPDATE Employees
SET Salary = Salary * 1.10
WHERE Department = 'Sales';
        

Example 3: Updating Multiple Columns

To update both the department and the salary for a specific employee:


UPDATE Employees
SET Department = 'Marketing',
    Salary = 72000
WHERE EmployeeID = 105;
        

Important Considerations

Common Clauses with UPDATE

While WHERE is the most common, other clauses can be used:

Related Topics