eolas/zk/Update_existing_data_in_SQL_table.md
2024-02-17 13:27:49 +00:00

624 B

tags
SQL
relational-databases

Update existing data with the SQL UPDATE command

We use UPDATE to modify existing records in our table.

Schematic syntax

UPDATE [table_name]
SET [field]
WHERE [conditional expression/filter]

Example

UPDATE manufacturer
SET url = '<http://www.hp.co.uk>'
WHERE manufacturer_id = 4; --typically this will be the primary key as you are updating and existing record and need to identify it uniquely

Update multiple fields

UPDATE manufacturer
SET url = '<http://www.apple.co.uk>',
    year_founded = 1977
WHERE manufacturer_id = 2;