Updating rows

Other times, you may want to change certain rows based on the value of a particular column. The SET clause specifies the columns to update and their new values, and the WHERE clause specifies the rows to update.

For example, if the telephone area code changed from ‘508’ to ‘978’, you could change every row with the old area code to the new area code with the following command:

UPDATE Customers 
SET LEFT(Phone,3) = ‘978’ 
WHERE LEFT (Phone, 3) = ‘508’