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: -
Here, we can see the existence of a default database provided by Hive.
- Let's create a new database by using the following command: -
So, a new database is created.
- Let's check the existence of a newly created database.
- Each database must contain a unique name. If we create two databases with the same name, the following error generates: -
- If we want to suppress the warning generated by Hive on creating the database with the same name, follow the below command: -
- Hive also allows assigning properties with the database in the form of key-value pair.
- Let's retrieve the information associated with the database.
No comments:
Post a Comment