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;
Search Keys
- sql drop statement
- if exists drop table
- drop temp table
- sql drop index
- sql drop all tables
- drop column sql
- drop all tables sql
- drop table sql
- drop sql server
- drop table in sql
- drop temp table sql
- sql drop columns
- drop view sql
- drop a table
- drop multiple tables
- t sql drop table if exists
- sql if exists drop table
- sql command drop database
- drop table tablename
- drop table script
- sql drop command
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 |
555 |
Haris Karthik |
25 |
Bangalore |
Sql Programming |
18000 |
666 |
Varshith Kutty |
28 |
Madurai |
Sql Programming |
18000 |
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.