Reprence Html CSS javascript PHP MySQL Bootsrap

MySQL UPDATE Statement




The MySQL UPDATE Statement

The UPDATE statement is used to modify the existing records in a table.


UPDATE Syntax
32

Demo Database

Below is a selection from the "Customers" table in the Northwind sample database:

33

UPDATE Table

The following SQL statement updates the first customer (CustomerID = 1) with a new contact person and a new city.

Example:

34

The selection from the "Customers" table will now look like this:


35

UPDATE Multiple Records

It is the WHERE clause that determines how many records will be updated.

The following SQL statement will update the PostalCode to 00000 for all records where country is "Mexico":

36

The selection from the "Customers" table will now look like this:


37

Update Warning!

38

The selection from the "Customers" table will now look like this:


39