MySQL Update syntax

MySQL Update syntax

The MySQL Update command syntax is as shown below.


UPDATE `TableName` SET `ColumnName` = ‘value’ WHERE condition ;
Example:
UPDATE `emp` SET `salary` = 5000 WHERE EmpID=100;


Update syntax contains three simple parts

  1. UPDATE `TableName` is the command that tells MySQL to update the data in a table.
  2. SET `ColumnName` = `value' is the table ColumnName and values of the fields to be affected by the update query.  
  3. “WHERE condition” is used in order to put a filter that reduces the number of records changed by the UPDATE query. In case, you miss it it will update all rows of the table.


Comments

Popular posts from this blog

MySQL Foreign Key Error[Solved] Error code 1215 & Error code 1452

What is the MySQL?