SQL Drop Table – Remove Data and Table Structure

SQL drop table with example in MySql – Learn how to remove table from a database.

SQL drop table statement do the following.

Removes one or more table from an existing database, means data and table structure [Table Definition] will be removed from the database.

SQL syntax to drop single table

Syntax:

DROP TABLE  [IF EXISTS]
[TABLE_NAME]
[RESTRICT|CASCADE] 

here is the example to drop the table BOOKS from the database

Query example:

DROP  TABLE
IF EXISTS
BOOKS;

the above query removes BOOKS table with all data from existing database.

SQL syntax to delete multiple tables from the database

Syntax:

DROP TABLE [TABLE_1],[TABLE_2]………………….; 

Example query to delete multiple tables.

Query example:

DROP TABLE ADDRESSBOOK,ORDERDETAILS;

the above query removes the tables   ADDRESSBOOK and  ORDERDETAILS from BOOKSTORE database.

Related Posts