Learn How to Delete or Remove Database using SQL

Learn How to Delete or Remove Database using SQL


In this lecture we will Learn how to remove or delete database, from database management system using SQL statement. Using standard SQL we can create as as well as remove the database from our database management system. The “DROP DATABASE” SQL statement is used to remove or delete the database including all the tables and data rows in it. Be careful before deleting the database completely from your database management system, because the system does not ask for confirmation. As soon as you run the SQL “DROP DATABASE” statement, the system will remove the database, tables. And data rows instantly and there is no easy method to recover the lost database. Here is the SQL statement to delete the database. Lets Learn how to remove or delete database from database management system with some practical examples. I’ve logged in my MySQL database server by using my root username and password. First of all lets display all the existing databases using SQL statement, “SHOW DATABASES;” The system displays all the available database. In previous lecture we created 2 databases called ‘1234d’ and ‘my_database’. Lets delete the database ‘1234d’. The SQL statement will be, “DROP DATABASE 1234d;” Press enter to execute the SQL statement, and we get ‘Query OK, 0 rows affected’ message. Now, if display all the existing databases using SQL statement, “SHOW DATABASES;” the database ‘1234d’ is gone. Similarly, we can delete the database ‘my_database’ using SQL statement, “DROP DATABASE my_database;” And if we display all the existing databases again, “SHOW DATABASES;” the database ‘my_database’ is successfully removed from MySQL.

Danny Hutson

Leave a Reply

Your email address will not be published. Required fields are marked *