Updating Data

To update (modify) data in a table the UPDATE statement is used. UPDATE can be used in two ways:

  • To update specific rows in a table

  • To update all rows in a table

You'll now take a look at each of these uses.

Caution

Don't Omit the WHERE Clause Special care must be exercised when using UPDATE, because it is all too easy to mistakenly update every row in your table. Please read this entire section on UPDATE before using this statement.

Tip

UPDATE and Security Use of the UPDATE statement might require special security privileges in client-server DBMSs. Before you attempt to use UPDATE, make sure you have adequate security privileges to do so.

The UPDATE statement is very easy to use—some would say too easy. The basic format of an ...

Get Sams Teach Yourself SQL in 10 Minutes 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.