Krivalar Tutorials 
Krivalar Tutorials



SQL-DROP DATABASE

<< Previous - SQL Create Database

Next - SQL Create Table >>




Drop database statement is used to delete the entire database.

Syntax
DROP DATABASE database-name;

Here database-name is to specify the name of existing database.

Note:

To run this above query, you must first get the administrator privileges.

For Example

Our RDBMS contains list of databases.


mysql> SHOW databases;
+--------------------+
| Database           |
+--------------------+
| collegedb          |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test-DB            |
| world              |
+--------------------+
7 rows in set (0.00 sec)

Now, we want to drop the [test-DB] database. For that the following statement will be run.

mysql> DROP DATABASE test-DB;
Query OK, 0 rows affected (0.15 sec)


After dropping the datatbase, we can check it whether that database is deleted or not by using show databases SQL statement.

mysql> SHOW databases;
+--------------------+
| Database           |
+--------------------+
| collegedb          |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| world              |
+--------------------+
6 rows in set (0.00 sec)

<< Previous - SQL Create Database

Next - SQL Create Table >>








Searching using Binary Search Tree