How to Delete a Database in MySQL

Notes:

How to delete a database from MySQL server:
- To delete a database from MySQL server; we take help of drop database command

Basic Syntax:
drop database [ if exists ] databasename;

Ex:
drop database db_chidrestechtutorials;
OR
drop database if exists db_ chidrestechtutorials;

Note:
- While deleting a database; if you do not specify if exists clause & the database that you want to delete does not exists in the server then error is thrown.

- While deleting a database; if you don’t know whether the database that you want to delete already exists in the server or not then you must specify if exists clause.

- While deleting a database; if you know that the database that you want to delete does exist in the server then you need not to specify if exists clause.

Interview Questions: