bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Learn/SQL/SQL Database
SQL•SQL Database

SQL DROP DATABASE Statement

The SQL DROP DATABASE Statement

The DROP DATABASE statement is used to permanently delete an existing SQL database.

Note

Be careful before dropping a database! Dropping a database deletes the database and all its content (tables, views, stored procedures, and data)!

Syntax

DROP DATABASE
databasename
;

Tip

You need administrative privileges to drop a database.

DROP DATABASE Example

The following SQL statement drops an existing database named "testDB":

Example

DROP DATABASE testDB;

Tip

Once a database is dropped, you can check that it is removed from the list of databases with: SHOW DATABASES; (MySQL) or SELECT name FROM sys.databases; (SQL Server).

Previous

SQL CREATE DATABASE Statement

Next

SQL BACKUP DATABASE Statement

This chapter

Overview
21

Lessons

50m

Read time

1. SQL CREATE DATABASE Statement2. SQL DROP DATABASE Statement3. SQL BACKUP DATABASE Statement4. SQL CREATE TABLE Statement5. SQL DROP TABLE Statement6. SQL ALTER TABLE Statement7. SQL Constraints8. SQL NOT NULL Constraint9. SQL UNIQUE Constraint10. SQL PRIMARY KEY Constraint11. SQL FOREIGN KEY Constraint12. SQL CHECK Constraint13. SQL DEFAULT Constraint14. SQL CREATE INDEX Statement15. SQL AUTO INCREMENT Field16. SQL Working With Dates17. SQL Views18. SQL Injection19. SQL Parameters20. SQL Prepared Statements21. SQL Hosting

On this page

The SQL DROP DATABASE StatementDROP DATABASE Example