【问题标题】:Insert extra columns with NULL values from one table to another table HIVE将具有 NULL 值的额外列从一个表插入到另一个表 HIVE
【发布时间】:2020-06-02 23:20:16
【问题描述】:

Table1 有列 col1 , col2 , col3 , col4 , col5

Table2 有列 col1 , col3 , col5

我想将 Table2 中的行插入到 Table1 中

但是 col2 , col4 插入 Table2 后应该是 NULL 数据类型

如何在 HIVE 中做到这一点,目前我使用的是 Hortonworks 3.1 版本

【问题讨论】:

    标签: sql hive


    【解决方案1】:

    你只需使用insert . . . select:

    insert into table1 (col1, col2, col3, col4, col5)
        select col1, null, col3, null, col5
        from table2;
    

    【讨论】:

    • @SanthoshChakka 。 . . “不工作”是什么意思?
    猜你喜欢
    • 1970-01-01
    • 2016-05-18
    • 2014-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-06
    • 1970-01-01
    相关资源
    最近更新 更多