Changing Data Using the WHERE Clause

Accessing and Changing Relational Data

Accessing and Changing Relational Data

Changing Data Using the WHERE Clause

The WHERE clause performs two functions:

  • Specifies the rows to be updated.

  • Indicates the rows from the source tables that qualify to supply values for the update if a FROM clause is also specified.

If no WHERE clause is specified all rows in the table are updated.

This UPDATE statement implements a name change for one of the shippers:

UPDATE Northwind.dbo.Shippers
SET CompanyName = 'United Shippers'
WHERE CompanyName = 'United Packages'