SQL DROP DATABASE Statement



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


Syntax

The syntax of the DROP DATABASE statement is as follows:

DROP DATABASE database_name;

The database name is unique within the database system.

Note: Dropping a database is irreversible. If you delete a database, you will lose all information stored in the database. So you must be sure that you want to drop a database.


DROP DATABASE - Example

The following SQL statement will permanently remove the existing database "demo_db" from the database server.

DROP DATABSE demo_db;

After executing the above command, if you try to select the "demo_db" database using the USE demo_db command, you will get an error message saying "Unknown database" or "Database does not exist".



ExpectoCode is optimized for learning. Tutorials and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy.
Copyright 2020-2021 by ExpectoCode. All Rights Reserved.