SQL DELETE statement
Related learning
View all courses
DELETE statement
To delete all the data from the table but not the table itself, use a query with a DELETE FROM statement.
For example, let's delete all the information from the following table titled books:

To do that with the query will be:
As a result of the query execution, the table books is empty now.
Delete selected rows
Use DELETE FROM statement to delete only selected rows from a table.
For example, let's delete some information from the following table titled books:

Some books from the table are unavailable (their quantity equals zero). To delete records about these books, the query with a WHERE clause will be:
This query will delete all the rows from the table books where the logical expression
is true.
After the execution of the query, the books table will look like this:

Written by
