0
votes

Table1 have columns col1 , col2 ,col3 , col4 , col5

Table2 have columns col1 , col3 , col5

I want to insert rows from Table2 to Table1

But col2 , col4 should be NULL datatype after inserting into Table2

How can I do it in HIVE , Currently I am using Hortonworks 3.1 version

1

1 Answers

0
votes

You just use insert . . . select:

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