In this section, we will learn how to delete the data from a table using the DROP query.
⚠️ Watch out! Running a DROP query will also delete all existing records from the table.
The basic syntax for the DROP query is as follows:
In this syntax, we have several elements that are elaborated on below.
- DROP represents the statement name.
- TABLE entity type you want to drop.
- table_name defines which table you want to remove.
We have a table named warehouse that stores the product's id, name, and quantity:
It will create a table as shown below:
1) Use the following query to delete the warehouse’s table:
2) If you have successfully run the query, you will get the following output: the table and the values within it are deleted.
😥 If you attempt to use the table for any operation, you will find that the table no longer exists.