【问题标题】:How to create an empty copy of a table in hive如何在 hive 中创建表的空副本
【发布时间】:2017-06-01 11:49:27
【问题描述】:

我有一张有很多列的表。 我不想写类似

的东西
CREATE TABLE IF NOT EXISTS 
table1( 
col1 int, 
col2 String,
etc....)

有没有一种快速的方法来创建具有相同结构但没有任何数据的表?

【问题讨论】:

    标签: hive create-table hiveddl


    【解决方案1】:

    试试这个:

    CREATE TABLE some_db.T1 LIKE some_db.T2
    

    请参阅本手册:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTableLike

    【讨论】:

    • 另外,您可以只显示使用SHOW CREATE TABLE <table>创建表的命令
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-15
    • 1970-01-01
    • 2017-02-19
    相关资源
    最近更新 更多