This article is to let you know how to move a table from one database to another in Hive.
CREATE TABLE TestDB.emp
AS
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..!!
No comments:
Post a Comment