SQL UPDATE

The UPDATE statement in SQL is used to modify existing records in a table. It allows you to change one or more columns in one or more rows of a table.

Syntax

The basic syntax of the UPDATE statement is:


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

        

Example

Here is an example of how to use the UPDATE statement to change the salary of an employee with a specific ID:


-- Example: Updating a salary
UPDATE Employees
SET Salary = 70000
WHERE EmployeeID = 1;