Hive allows us to save the output data of Hive queries by creating new Hive tables. We can also insert the resultant data of a Hive query into another existing table as well.
The following steps show you how to store the result of a Hive query into a new Hive table:
Issue the following query to save the output of the query of step 3 of the preceding recipe to a table named
tmp_users
:hive> CREATE TABLE tmp_users AS SELECT user_id, location, age FROM users WHERE age>18 and age <34; … Table bookcrossing.tmp_users stats: [num_partitions: 0, num_files: 1, num_rows: 0, total_size: 2778948, raw_data_size: 0] 74339 Rows loaded to hdfs://localhost:8020/tmp/hive-root/hive_2014-07-08_02-57-18_301_5868823709587194356/-ext-10000
Inspect the data of the newly created table using the following command:
hive> select...