O'Reilly logo

Apache Hive Essentials by Dayong Du

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hive database

The database in Hive describes a collection of tables that are used for a similar purpose or belong to the same groups. If the database is not specified, the default database is used. Whenever a new database is created, Hive creates a directory for each database at /user/hive/warehouse, defined in hive.metastore.warehouse.dir. For example, the myhivebook database is located at /user/hive/datawarehouse/myhivebook.db. However, the default database doesn't have its own directory. The following is the core DDL for Hive databases:

  • Create the database without checking whether the database already exists:
    jdbc:hive2://> CREATE DATABASE myhivebook;
    
  • Create the database and check whether the database already exists:
    jdbc:hive2://> CREATE DATABASE ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required