Learn how to use the SQL DROP TABLE Statement with the explained examples given in this tutorial. To delete a table using the SQL DROP TABLE statement, you have to specify the table name.

One thing you should note here if you delete the table using the SQL DROP TABLE statement. You may lose the table as well the data of the table.

If you want to delete only the data of the table, you can use SQL TRUNCATE TABLE statement.

How to Use SQL DROP Table to Delete a Table

Deleting a table using the DROP statement is the simple method. You just need to specify the name of the table. After executing the query, the table and all its data get deleted.
Syntax

The above syntax contains the single parameter to use and delete a table. The description of the parameter is given below.

Sr. No. Parameter Name Sr. No.
1 tablename Specify the name of the table that you want to delete from the database.

Examples to Delete a Table Using SQL DROP TABLE Statement

You just need to indicate the name of the table in the syntax given above. This will delete the table along with the data you have on the table. So, if you want to delete all the data of the table, you can use the truncate method of SQL.
Example1: Delete table Employee

The above example deletes the Employee table as well all its data from the database.
Example2: Delete table Student

This deletes the table Student and removes all the data from this table.

You must also learn.

Reference

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.