DEV Community

Abubakar Sadiq Sirajo
Abubakar Sadiq Sirajo

Posted on

UPDATE > MariaDB

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 ...]  
Enter fullscreen mode Exit fullscreen mode

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;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)