From the course: MySQL Essential Training
Unlock this course with a free trial
Join today to access over 23,400 courses taught by industry experts.
Deleting data - MySQL Tutorial
From the course: MySQL Essential Training
Deleting data
- [Bill] Hi, I'm Bill Wyman. The DELETE statement is used to remove rows from a table. For this lesson, we'll use the scratch database as modified in the previous lessons. I'm going to go ahead and execute this USE scratch statement, and that'll open that database for us. I've pasted in some lines here from the chapter one exercise files. What this does is it creates a simple table called test with three columns, and then it inserts these three rows into it. So I'm going to go ahead and select those four lines and execute that, and you can see down there in our status that worked. And I can SELECT * FROM test, and we can see those three rows that I've just inserted into this new table. Now if we want to delete one of those rows, first, I'm going to copy this SELECT here, and I'm going to say SELECT * FROM test WHERE a = 1. And when I execute that, you see we get one row. Now that's the row I want to delete. I tested my WHERE statement first, because we're going to use that with the…
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
-
-
-
A brief overview of SQL4m 28s
-
(Locked)
Database organization2m 51s
-
(Locked)
Selecting rows5m 47s
-
(Locked)
Selecting columns2m 21s
-
(Locked)
Counting rows3m 5s
-
(Locked)
Inserting data3m 26s
-
(Locked)
Updating data4m 12s
-
(Locked)
Deleting data4m 10s
-
(Locked)
Joining queries across tables3m 57s
-
(Locked)
Finding databases, tables, and columns1m 24s
-
-
-
-
-
-
-