SQL – DROP DATABASE -Delete a database in SQL.

You have a database and for some reasons you want to delete it.

Solution –

To delete a database You can use DROP DATABASE statement.

To see all the databases you have, you can use the following query.

# MySQL
SHOW DATABASES;

# PostgreSQL
SELECT datname FROM pg_database;

Now to delete the lwd database, I will use

DROP DATABASE lwd;

Note – Please be careful, once you delete a database you won’t able to recover it.

Leave a Reply