SQL Update

SQL Update

The SQL command UPDATE is used to modify records values into an SQL table.

Update syntax

UPDATE table_name
SET
column1 = new_value1,
column2 = new_value2,
column3 = new_value3,
...
WHERE {condition}

Update example

UPDATE coder_books 
SET price = 21 
WHERE id = 1 AND title = 'Learn SQL';

UPDATE coder_books SET price = price+5 WHERE price > 20;

UPDATE coder_books 
SET 
price = price+1,
description = CONCAT(description, ' + pdf version')
WHERE price >= 10;