How to Drop Database in SQL Server

aimtocode

SQL Database: Definition

The DROP DATABASE Statement is used to drop or delete the database. Dropping of the database will drop all database objects (tables, views, procedures etc.) inside it. The user should have admin privileges for deleting a database.

It means the SQL DROP DATABASE statement is used to drop an existing database in SQL schema.

Syntax:

  							   
  SQL> DROP DATABASE demoDB;

Example:

Make sure you have the admin privilege before dropping any database.


  DROP DATABASE demoBD;


Once you finish droping the database you view by using SQL SHOW DATABASES like this.

SQL> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| AMROOD             |
| aimtocode              |
| mysql              |
| orig               |
| test               |
+--------------------+
6 rows in set (0.00 sec)

The DROP TABLE statement permanently erase all data from the table, as well as the metadata that defines the table in the data dictionary.

aimtocode