SQL DROP TABLE

A SQL DROP TABLE statement is used to delete a table definition and all data from a table.

This is very important to know that once a table is deleted all the information available in the table is lost forever, so we have to be very careful when using this command.

Let's see the syntax to drop the table from the database.

Let us take an example:

First we verify STUDENTS table and then we would delete it from the database.

FIELD TYPE NULL KEY DEFAULT EXTRA
ID Int(11) NO PRI
NAME Varchar(20) NO
AGE Int(11) NO
ADDRESS Varchar(25) YES NULL

This shows that STUDENTS table is available in the database, so we can drop it as follows:

Now, use the following command to check whether table exists or not.

As you can see, table is dropped so it doesn't display it.


SQL DROP TABLE Example in MySQL

Let's see the command to drop a table from the MySQL database.


SQL DROP TABLE Example in Oracle

Let's see the command to drop a table from Oracle database. It is same as MySQL.


SQL DROP TABLE Example in Microsoft SQLServer

Let's see the command to drop a table from SQLServer database. It is same as MySQL.

Next TopicSQL DELETE TABLE




Contact US

Email:[email protected]

SQL DROP TABLE
10/30