Published Jun 4, 2021Updated Aug 18, 2022
Contribute to Docs

The UPDATE command edits one or more rows in a table.


UPDATE table_name
SET some_column = some_value
WHERE some_column = some_value;

A SET clause is included to indicate that the column to edit as well as a WHERE clause for specifying the record(s).


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

UPDATE customers
SET name = 'Code Ninja', city = 'Brooklyn'
WHERE customer_id = 123;

All contributors

Looking to contribute?

Learn SQL on Codecademy