The DROP DATABASE SQL statement is used to delete an existing database in SQL.

The syntax of the DROP DATABASE command in SQL

DROP DATABASE ten_co_so_du_lieu;

Ten_co_so_du_lieu is always unique in RDBMS.

Example of the DROP DATABASE command in SQL

If you want to delete an existing database, such as Quantrimang, the DROP DATABASE command will be written as follows:

SQL> DROP DATABASE Quantrimang;

Note: Be careful when performing this action because deleting the existing database may destroy the information stored in the database.

Make sure you have admin rights before deleting any database.When the database is removed, you can check the following in the database list:

SQL> SHOW DATABASES; +--------------------+ | Database     | +--------------------+ | CONGNGHE     | | LANGCONGNGHE   | | WINDOWS      | | mysql       | | ANDROID      | | iOS        | +--------------------+ 6 rows in set (0.00 sec)

The DROP DATABASE command is pretty simple, right?In the next article, we will learn about the USE command, which is used to select the database

Leave a Comment

Close