【发布时间】: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 版本
【问题讨论】:
Table1 有列 col1 , col2 , col3 , col4 , col5
Table2 有列 col1 , col3 , col5
我想将 Table2 中的行插入到 Table1 中
但是 col2 , col4 插入 Table2 后应该是 NULL 数据类型
如何在 HIVE 中做到这一点,目前我使用的是 Hortonworks 3.1 版本
【问题讨论】:
你只需使用insert . . . select:
insert into table1 (col1, col2, col3, col4, col5)
select col1, null, col3, null, col5
from table2;
【讨论】: