Duplicate Table in Hive: Copy Data Fast

There are two ways to copy tables and data in Hive:

  1. Replicate the table structure using the CREATE TABLE statement.
CREATE TABLE new_table_name LIKE original_table_name;

This will create a new table with the same structure as the original table, but without any data.

  1. Copy data using INSERT INTO statement:
INSERT INTO new_table_name SELECT * FROM original_table_name;

This will copy all the data from the original table to the new table.

By combining these two methods, you can replicate tables and data in Hive.

bannerAds