UPDATE

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 ...

Get Visual Basic® .NET Database Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.