SQL UPDATE Statement

The SQL UPDATE statement is used to modify data in a database table. It is used to update existing records in a table, rather than inserting new ones like the INSERT statement. The UPDATE statement is an essential part of any SQL query and is commonly used to keep database records up to date.

Syntax

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

Example

UPDATE customers
SET city = 'Los Angeles'
WHERE customer_id = 123;
    

This example updates the city for the customer with ID 123 to "Los Angeles" in the "customers" table.

Options

There are many other options and clauses that can be used with the UPDATE statement, such as JOIN and ORDER BY. You can learn more about these and other advanced topics in our SQL tutorials and references.