102 SQL DROP DATABASE
The current webpage explains the SQL DROP DATABASE statement. Hereās a summary:
- The
DROP DATABASEstatement is used to delete an existing database in SQL. - Syntax:
DROP DATABASE databasename; - Warning: Dropping a database deletes all information stored in itāthis action is permanent and should be done with caution.
- Example:
DROP DATABASE testDB; - Tips:
- You need admin privileges to drop a database.
- After dropping, you can verify it was deleted using:
SHOW DATABASES;- There is also an interactive quiz on the page to test your understanding.
In essence, use DROP DATABASE to completely remove a database, losing all its contents permanently.[1]
The SQL DROP DATABASE Statement
TheĀ DROP DATABASEĀ statement is used to drop an existing SQL database.
Syntax
DROP DATABASE databasename;
Note:Ā Be careful before dropping a database. Deleting a database will result in loss of complete information stored in the database!
DROP DATABASE Example
The following SQL statement drops the existing database "testDB":
DROPĀ DATABASEĀ testDB;
Tip:Ā Make sure you have admin privilege before dropping any database. Once a database is dropped, you can check it in the list of databases with the following SQL command:Ā
SHOW DATABASES;