SQL DROP Table

This statement is used to DROP OBJECTS in the database. It can be a whole database or just a table, index, or view.

Note: Be careful while dropping a table. Deleting a table will result in loss of all information related to it .

Syntax :

DROP OBJECT "objectName";

object can be

DROP TABLE "tableName";

DROP DATABASE "databaseName";

This statement is used to delete table or database itself..

Parameters :

tableName : Name of the table which we wish to DROP.

databaseName : Name of the database which we wish to DROP.

Examples :

We will be using the same table which we have created using the CREATE TABLE and INSERT STATEMENT.

Using Select to see all the records before drop query runs.

SELECT * FROM `employee`;

before-update-query-execution-example1

DROP TABLE `employee`;

Above query will drop all the data related to table and its structure.

Reffering to Create database statement. We will be using same database name.

DROP DATABASE `tutorialmines`;

Above query will drop the database and all related item of it.


Related articles : CREATE TABLE , INSERT STATEMENT, TRUNCATE TABLE, CREATE DATABASE STATEMENT.

You may also like...

Leave a Reply

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