SQL DROP DATABASE, DROP TABLE statement

SQL DROP DATABASE statement

The SQL DROP DATABASE statement is used to remove or delete a existing database from your database systems.

Note: This action cannot be undone.


SQL DROP DATABASE syntax

The basic syntax is:


DROP DATABASE database_name;


SQL DROP DATABASE Example

The following statement is to remove a existing database.


DROP DATABASE MyDB;

The above statement will delete the database named "MyDB" from your database systems.


SQL DROP TABLE statement

The SQL DROP TABLE statement is used to delete or remove a database table.

The SQL DROP TABLE statement will remove the database table completely (it removes all table records and table structure).


SQL DROP TABLE Syntax

The below syntax is used to delete sql database table:


DROP TABLE table_name;


Sample Database Table - Employee

Let's take a sample table called "Employee" and it will look like this:

ID EName EAge ECity EDept ESalary
111 Suresh Babu 32 Nasik Sql Programming 12000
222 Siva Kumar 22 Chennai Database Administrator 23000
333 Suresh Kumar 33 Nasik Sql Hacker 16000
444 Bala Murugan 20 Madurai Database Administrator 23000

SQL DROP TABLE Example

Following is an example, which delete the "Employee" completly(all rows and columns).

We use the following DROP TABLE statement:


DROP TABLE Employee;

Note: This action cannot be undo.

You can also search these topics using if table exists drop table, truncate table sql server, truncate table in sql, sql truncate table, sql truncate command, sql truncate query, sql remove column, sql remove data from table, sql remove from table, sql remove database, sql remove record, sql remove command, sql delete column from table, sql clear all tables, sql clear table contents, sql clear a table, delete table query.