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?

Our premium learning platform, created with over a decade of experience and thousands of feedbacks.

Learn and improve your coding skills like never before.

Try Programiz PRO
  • Interactive Courses
  • Certificates
  • AI Help
  • 2000+ Challenges