I have a table with lots of columns. I don't want to write something like
CREATE TABLE IF NOT EXISTS
table1(
col1 int,
col2 String,
etc....)
Is there a fast way to create a table with the same structure, but without any data?
Try this:
CREATE TABLE some_db.T1 LIKE some_db.T2
See this manual: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTableLike
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With