This SQL tutorial explains how to use the SQL DROP TABLE statement with syntax and examples.
The SQL DROP TABLE declaration approves you to cast off or delete a desk from the SQL database.
The syntax for the DROP TABLE assertion in SQL is:
DROP TABLE table_name;
Parameters or Arguments
table_name The title of the table to do away with from the database.
You can also have observed that you’ve got created a desk that you no longer require. You can use the DROP TABLE assertion to remove the table from your database.
Let’s appear at an example that shows how to drop a desk the usage of the DROP TABLE statement.
DROP TABLE suppliers;
This DROP TABLE declaration instance would drop the desk referred to as suppliers. This would both dispose of the archives associated with the suppliers table as properly as its desk definition.
Once you have dropped the table, you can recreate the suppliers table barring getting an error that the desk already exists.
Let’s appear at one more instance where we prefix the table identify with the database name.
DROP TABLE totn.contacts;
In this example, e have dropped a table referred to as contacts that is in the totn database.
TIP: It is every so often simpler to drop a table and recreate it, instead of the use of the ALTER TABLE assertion to trade the table’s definition.