Javatpoint Logo
Javatpoint Logo

Hive - Drop Database

In this section, we will see various ways to drop the existing database.

  • Let's check the list of existing databases by using the following command: -

Hive Drop Database
  • Now, drop the database by using the following command.

Hive Drop Database
  • Let's check whether the database is dropped or not.

Hive Drop Database

As we can see, the database demo is not present in the list. Hence, the database is dropped successfully.

  • If we try to drop the database that doesn't exist, the following error generates:
Hive Drop Database
  • However, if we want to suppress the warning generated by Hive on creating the database with the same name, follow the below command:-
Hive Drop Database
  • In Hive, it is not allowed to drop the database that contains the tables directly. In such a case, we can drop the database either by dropping tables first or use Cascade keyword with the command.
  • Let's see the cascade command used to drop the database:-

This command automatically drops the tables present in the database first.

Next TopicHive Create Table




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA