Home » Hive Create Database

Hive Create Database

by Online Tutorials Library

Hive – Create Database

In Hive, the database is considered as a catalog or namespace of tables. So, we can maintain multiple tables within a database where a unique name is assigned to each table. Hive also provides a default database with a name default.

  • Initially, we check the default database provided by Hive. So, to check the list of existing databases, follow the below command: –

Hive Create Database

Here, we can see the existence of a default database provided by Hive.

  • Let’s create a new database by using the following command: –

Hive Create Database

So, a new database is created.

  • Let’s check the existence of a newly created database.

Hive Create Database

  • Each database must contain a unique name. If we create two databases with the same name, the following error generates: –

Hive Create Database

  • If we want to suppress the warning generated by Hive on creating the database with the same name, follow the below command: –

Hive Create Database

  • Hive also allows assigning properties with the database in the form of key-value pair.

Hive Create Database

  • Let’s retrieve the information associated with the database.

Hive Create Database

Next TopicHive Drop Database

You may also like