HERE

	UPDATE `table_name` is the command that tells MySQL to update the data in a table .

	SET `column_name` = `new_value’ are the names and values of the fields to be affected by the update query. Note, when setting the update values, strings data types must be in single quotes. Numeric values do not need to be in quotation marks. Date data type must be in single quotes and in the format ‘YYYY-MM-DD’.

	[WHERE condition]  is optional and can be used to put a filter that restricts the number of rows affected by the UPDATE MySQL query.

Update in MySQL Example

Let’s now look at a practical example that updates data in the members table. Let’s suppose that our member’s membership numbers 1 and 2 have the following updates to be made to their data records. We will start with making updates for membership number 1 before we make any updates to our data, let’s retrieve the record for membership number 1. The script shown below helps us to do that. Executing the above script gives us the following results. Let’s now update the contact number using the script shown below. Executing the above script updates the contact number from 999 to 0759 253 532 for membership number 1. Let’s now look at the record for membership number 1 after executing the update script. Executing the above script gives us the following results. Let’s now look at the updates required for membership number 2. The following script helps us to do that. Executing the above script in updates the full names for membership number 2 to Janet Smith Jones and the physical address to Melrose 123.

Summary

The update command is used to modify existing data. The “WHERE clause” is used to limit the number of rows affected by the UPDATE query.