Moving a table from one Hive database to another

This article is to let you know how to move a table from one database to another in Hive.

SELECT * FROM dbTest.emp;

The above statement will create a table (named “emp”) in the database in which you want to move the table and import the data from the old one. You can keep your old table in the old database or you can simply drop it.

If you do not want to use the “create” statement, then you have a choice to alter the table location as mentioned below.

ALTER TABLE TestDB.emp RENAME TO dbTest.emp;

Hope it helps..!!

One comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s