The UPDATE command helps us to change or modify the records that have already been inserted into a table. You can combine it with the WHERE clause to specify the record that is to be updated. Here is the syntax:
UPDATE tableName SET field=newValue, field2=newValue2,...
[WHERE ...]
The UPDATE command can also be combined with clauses such as SET, WHERE, LIMIT, and ORDER BY. You will see this shortly:
Letβs change the price of the book with an id of 1 from 200 to 250:
UPDATE price
SET price = 250
WHERE id = 1;
Top comments (0)