SQL DROP DATABASE Statement

In SQL, DROP DATABASE is used to delete a database from our Database Management System.

Example

DROP DATABASE my_database;

Here, the SQL command will delete a database named my_database.

Also, you need admin or DROP permission to run this command.


DROP DATABASE Syntax

The syntax of the SQL DROP DATABASE statement is:

DROP DATABASE database_name;

Here, database_name is the name of the database to be removed.

Note: When we delete a database, all tables and records within a database are also deleted.


List All Databases

To verify the drop query, we can run the following command to list the available databases.

SHOW DATABASES;

Here, the SQL command lists all the available databases in the DBMS.


Recommended Reading

Did you find this article helpful?

Your builder path starts here. Builders don't just know how to code, they create solutions that matter.

Escape tutorial hell and ship real projects.

Try Programiz PRO
  • Real-World Projects
  • On-Demand Learning
  • AI Mentor
  • Builder Community