DROP or DELETE Database In SQL

 Admin   
181 View    Jan 30 2020 10:54PM

The SQL DROP DATABASE statement is used to drop an existing database in SQL schema.

Syntax

The basic syntax of DROP DATABASE statement is as follows −

DROP DATABASE Database Name;

Always the database name should be unique within the RDBMS.

Example

If you want to delete an existing database <testDB>, then the DROP DATABASE statement would be as shown below −

SQL> DROP DATABASE testDB;

 

NOTE:-

Be careful before using this operation because by way of deleting an current database would bring about lack of complete information stored inside the database.

Make sure you've got the admin privilege before losing any database. Once a database is dropped, you can check it within the list of the databases as shown below –

 

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