MySQL UPDATE

Last Updated: March 11, 2022

MySQL UPDATE statement is used to update the data in the table

Use the where clause otherwise it will update all rows of the table.

UPDATE Syntax

UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE conditio

Example

Update the name of the employee where the id of the employee is equal to 1 and update the salary to 120000

UPDATE employees
SET name = 'John Miller',salary=120000
WHERE id = 1;
Test