SQL Drop DB

DROP DATABASE permanently deletes a database and all its data. Use with extreme caution.

On this page

SQL DROP DATABASE

The DROP DATABASE statement permanently deletes a database and all of its tables, data, and objects.

Basic Syntax

DROP DATABASE database_name;

Example

DROP DATABASE company_db;

This removes the entire company_db database.

Important Warning

Once a database is dropped, it cannot be recovered unless you have a backup. Always double-check before executing this command.

Using IF EXISTS

To avoid errors if the database does not exist:

DROP DATABASE IF EXISTS company_db;

Permissions Required

You must have sufficient privileges to drop a database.

Best Practices

  • Always create backups before dropping databases
  • Verify the database name carefully
  • Avoid running DROP commands in production without confirmation

Common Mistakes

  • Dropping the wrong database
  • Running DROP in the wrong environment (production instead of development)
  • Not checking active connections

Next Step

Continue with SQL Backup DB to learn how to protect your data before making destructive changes.