So we've made it to the end.
The final video solution to our spring cleaning extravaganza problem.
Now we need to delete.
We've covered creating, reading and updating, basically inserting, selecting and update.
Now we're going to use delete.
So the first thing is to delete all old shirts, which really just in this case means last worn is 200.
Exactly.
So when we do our select star, you can see there's two shirts that meet that criteria, seven ID of
seven and ID of two, but we're going to delete them based off of last one.
So we always start with our select star from shirts where last one equals 200.
When we get our two shirts.
So then we can copy this and actually we can copy this entire thing.
Delete from shirts where last worn is 202 rows affected.
Now if we do a select star, those two are gone.
You can see it goes from 1 to 3 and then from 6 to 8 and there we go.
So the next problem is to delete all tank tops.
We've decided tank tops make us look kind of stupid.
So we're going to delete tank tops.
So your tastes have changed.
So how many tank tops do we have?
We've got one and two that are left.
So we'll do a select star from shirts where article equals tank top we get to.
Then all we need to do now is delete from shirts where article equals tank top.
Hit enter.
Now, if we try and select them, they're gone.
And if we do a select star from shirts with no where clause, now we have one, three, five, six,
nine.
So we've lost our two tank tops.
All we have are T-shirts and polo shirts.
Which leads us to our final exercise here.
Delete all the shirts and I lie to to actually the second to last.
So to delete all the shirts, but not the entire table, it's pretty simple.
We use the same word clause which which is to say that we don't have a wear clause.
So in this case it returns select star from shirts.
Returns all shirts.
Well, we just replace that delete from shirts.
If I can spell it correctly with this part.
And moment of truth.
Five rows affected.
Now, when they do select star from shirts, we get nothing.
It's a sad day.
Not as sad as when he deleted the cats, but still sad.
And the last thing is to drop the entire shirts table.
We're just done with this.
We hated this exercise.
We want to move on.
So drop table shirts now.
Hit enter.
And if I do show tables, no tables, and if I try and describe shirts, we get an error because there
is no shirts table to describe and it freaks out.
So we've successfully deleted it.
Now we have an empty database that we don't need anymore, and we're done with this.
Congratulations.