UPDATE

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

Syntax

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).

Example

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;

Contributors

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

Learn SQL on Codecademy