20

Updating and Deleting Data

In this chapter, you will learn how to use the UPDATE and DELETE statements to further manipulate table data.

Updating Data

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

  • To update specific rows in a table

  • To update all rows in a table

Let’s take a look at each of these uses.

Caution

Don’t Omit the WHERE Clause Take special care when using UPDATE because it is very easy to mistakenly update every row in a table. Please read this entire section on UPDATE before using this statement.

Note

UPDATE and Security Use of the UPDATE statement can be restricted and controlled. See Chapter 28, “Managing Security.”

The UPDATE statement is very easy to use—maybe even ...

Get MySQL Crash Course, 2nd Edition 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.