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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Inserting records into tables8m
-
(Locked)
Updating data records7m 33s
-
(Locked)
Challenge: Inserting and updating records1m 30s
-
(Locked)
Solution: Inserting and updating records7m 30s
-
(Locked)
Deleting specific records9m 41s
-
(Locked)
Deleting all records with TRUNCATE10m 28s
-
(Locked)
Challenge: Deleting records1m 32s
-
(Locked)
Solution: Deleting records8m 16s
-
(Locked)
-
-
-
-
-