The SET command, used with UPDATE, specifies which columns and values should be updated in a table.
The following SQL updates the first customer (CustomerID = 1) with a new ContactName and a new City:
UPDATE Customers SET ContactName = ‘Alfred Schmidt’, City= ‘Frankfurt’ WHERE CustomerID = 1; |
The provided SQL will update the “ContactName” field to “Juan” for all records where the Country is “Mexico”:
UPDATE Customers SET ContactName=‘Juan’ WHERE Country=‘Mexico’; |
Note: Caution should be exercised when updating records in a table. Observe the WHERE clause in the UPDATE statement. It specifies which record(s) should be updated. Omitting the WHERE clause will result in updating all records in the table. |