Description

The SQL keyword DATABASE is used to create or delete a database.

  • It is used along with the keyword CREATE to create a new database.
  • It is used along with the keyword DROP to drop an existing database.

CREATE DATABASE

The keyword CREATE DATABASE is used to create a new database, which requires admin access.

The below SQL creates a new database with the name "test_db".

CREATE DATABASE test_db;

DROP DATABASE

The keyword DROP DATABASE is used to delete an existing database, which deletes the database permanently.

The below SQL deletes an existing database with the name "test_db".

DROP DATABASE test_db;

SHOW DATABASES

After creating or deleting a database from a database system, we can always check the list of databases in a database system using the below SQL.

SHOW DATABASES;

Related Links