UPDATE

Edits row(s) in a table.

Syntax

The UPDATE statement is used to edit records (rows) in a table. It includes a SET clause that indicates the column to edit and a WHERE clause for specifying the record(s).

UPDATE table_name
SET some_column = some_value
WHERE some_column = some_value;

Example

The given query will update the row for a specific customer ID in the customers table:

UPDATE customers
SET name = 'Sonny Li', city = 'Brooklyn'
WHERE customer_id = 420;
Edit this page on GitHub

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your feedback.

Learn SQL on Codecademy

Edit this page on GitHub

Contributors