April 2002
Intermediate to advanced
416 pages
11h 50m
English
The UPDATE statement modifies a record in a table. The basic syntax is
UPDATE table_name SET field1 = value1, field2 = value2, ... [WHERE condition]
The following statement fixes a typographical error, changing the Employees table’s LastName field value to Jones in every record that currently has a LastName value of Jone:
UPDATE Employees SET LastName = 'Jones' WHERE LastName = 'Jone'
It is important to remember that the database modifies every record in the database that meets the statement’s WHERE conditions. If there happened to be a second record that was really supposed to have the LastName value Jone, this statement would modify that record, too.
To prevent possible accidents like this one, many tables have a primary key that ...
Read now
Unlock full access