Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Modifying Data with SQL!
You have completed Modifying Data with SQL!
Preview
In this video, we'll see how to delete all data from a table.
SQL Used
To delete all rows from a table:
DELETE FROM <table>;
Examples:
DELETE FROM logs;
DELETE FROM users;
DELETE FROM products;
See all of the SQL used in Modifying Data With SQL in the Modifying Data With SQL Cheatsheet.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Remember the four CRUD operations,
create, read, update, and delete.
0:00
We know the first three keywords too.
0:01
Insert to create, select to read,
and update to update.
0:03
Just like update, delete's keyword
is the same as the action.
0:07
Delete.
0:10
To write a delete statement,
you'd write something like this.
0:11
DELETE FROM table name.
0:14
The delete keyword removes
rows from a table.
0:17
It doesn't just empty the rows' values,
it removes the rows altogether.
0:21
Let's delete all the data from a table.
0:26
Let’s imagine we’ve had the sad news
that our library was closing down.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up