From the course: MySQL Database Administration

Unlock this course with a free trial

Join today to access over 24,500 courses taught by industry experts.

Deleting specific records

Deleting specific records - MySQL Tutorial

From the course: MySQL Database Administration

Deleting specific records

- [Instructor] All right, we're ready to talk about deleting records. So MySQL allows us to target one or more records and delete them from a given data table. We're going to do this using the DELETE FROM statement followed by the tablename. And then most of the time we're going to want to specify which records we want to delete using a WHERE clause. If we don't specify the WHERE clause, the server's going to delete all records from that table. Here's a little preview of one of the things that we'll be doing. We'll be deleting one of the inventory items from the inventory table in our thrift shop schema. At this point you should be pretty familiar with that schema, but I'll walk you through that before we delete the record. And here's what we're going to see. Right now we have 13 records in that inventory table, including the ski blanket record, inventory_id seven. And then after we run our delete, we'll see that record gets deleted from the table. We'll also talk about ROLLBACK and…

Contents