MySQL – UPDATE Record
The UPDATE statement in MySQL allows you to modify existing records in a table. In general, the UPDATE statement consists of the following syntax:
UPDATE table_name SET column1 = value1, column2 = value2, ... WHERE some_column = some_value;
Below is an example of how to use the UPDATE statement to change the name of an employee with the ID of 5 in a table called “employees”:
UPDATE employees SET name = 'James' WHERE emp_no = 5;
This would change the name of the employee with an ID of 5 from its current value to ‘james’ in the “employees” table.
If the WHERE clause is omitted, you can also use the UPDATE statement to update multiple records simultaneously:
UPDATE employees SET first_name = 'Jane', last_name = 'Smith' WHERE emp_no = 10001;