Data exchange – INSERT
To extract the data from Hive tables/ partitions, we can use the INSERT
keyword. Like RDBMS, Hive supports inserting data by selecting data from other tables. This is a very common way to populate a table from existing data. The basic INSERT
statement has the same syntax as a relational database's INSERT
. However, Hive has improved its INSERT
statement by supporting OVERWRITE
, multiple INSERT
, dynamic partition INSERT
, as well as using INSERT
to files. The following are a few examples:
- The following is a regular
INSERT
from theSELECT
statement:--Check the target table, which is empty. jdbc:hive2://> SELECT name, work_place, sex_age . . . . . . .> FROM employee; +-------------+-------------------+----------------+ |employee.name|employee.work_place|employee.sex_age| ...
Get Apache Hive Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.