Lesson 26

Deleting Data

In this lesson you learn how to delete rows from tables in the MySQL database. The examples from this lesson use the same tables used in the examples in Lesson 25.

note

You can download the code for this example from the book's web page at www.wrox.com. You can find it in the Lesson 26 folder in the download in a file labeled lesson26a.sql.

The first table is the authors table as shown in Figure 26-1.

The second table is the types table as shown in Figure 26-2.

The third table is the books table as shown in Figure 26-3.

Using the DELETE Command

Later on in this lesson I ask you to restore the example tables back to this point. If you are entering the examples, then you should make a backup by exporting the files now. If you are using the downloaded file lesson26a.sql, then you can just use that file when you are asked to restore.

note

If you don't remember how to back up MySQL tables by exporting them, see “Backing Up and Restoring” ...

Get PHP and MySQL® 24-Hour Trainer 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.