How to Create and Drop Apache Hive databases/schemas
Continuing with our Apache Hive tutorial series now we will see how we can create & drop Hive databases.
A database in Hive is a namespace or a collection of tables. The uses of SCHEMA and DATABASE are interchangeable and has the same effect.
The base syntax to create a database in Hive is:
To create a database in Hive
Create a new Hive Database with custom description and location
To see the database definition/descriptions
Or you can query the MySQL databases that holds the metastore
loging to your local MySQL server.
Query the DBS table from the hive database
Drop database syntax:
to drop a database use the following syntax:
Note:
if database is not empty you will get and error
To force the drop a Hive database that contains objects you need to use the CASCADE option