This recipe walks you through the commands to create Hive databases and tables using the Hive CLI. Hive tables are used to define structure (schema) and other metadata information such as the location and storage format on datasets stored in HDFS. These table definitions enable the data processing and analysis using the Hive query language. As we discussed in the introduction, Hive follows a "schema on read" approach, where it imposes this structure only when reading and processing the data.
This section depicts how to create a Hive table and how to perform simple queries on the Hive tables:
Start the Hive CLI by running the following command:
$ hive
Execute the following command to create and use a Hive database for the Book-Crossing dataset mentioned in the introduction:
hive> CREATE DATABASE bookcrossing; hive> USE bookcrossing;
Use the following command to...