SQL drop database Example – Learn how to drop existing database in MySQL with example and important points.
SQL Syntax to delete / drop a database
Drop Database [IF EXISTS] [Database_Name].
SQL Query example to delete the data base BOOKSTORE
Drop Database BOOKSTORE;
NOTES ON DROP SQL DATABASE
- If trying to delete a data base which is not existing in the database server,database server throws an error “ERROR 1008 : Can’t drop database ‘bookstore’; database doesn’t exist”. In this case the following query
Drop Database IF EXISTS BOOKSTORE;
IF EXISTS is an optional clause of the statement , that prevents in removing a database that does not exists in the database server.
- Removing a database means deleting the database physically. All the data and associated objects are deleted permanently and this can’t be undone.