MySQL Update Data

In previous articles, you have learned to create, insert and select data. Now in this article, you will learn to update existing records of a table.

The MySQL provides UPDATE statement to update existing data in a table.

Update query syntax

UPDATE Tablename SET column1 = value1, column2 = value2 [WHERE Clause];
  • SET clause is used with the UPDATE table to set values for updating columns.
  • The modified columns are separated by comma.
  • WHERE clause is used to apply condition to update rows.
  • You can update one or many rows fields together.


The following query updates the 'last_name' and 'age' of student whose id is '2' from 'students' table.

mysql->UPDATE students SET last_name = 'Gavin', age = '11' WHERE id = '2'; 

baseurl.'/images/mysqlupdate.jpg'; ?> alt="MySQL Update Table">