Learnerslesson
   JAVA   
  SPRING  
  SPRINGBOOT  
 HIBERNATE 
  HADOOP  
   HIVE   
   ALGORITHMS   
   PYTHON   
   GO   
   KOTLIN   
   C#   
   RUBY   
   C++   




HIVE UNION

UNION

The UNION operator in HIVE is used to combine the contents the two or more SELECT statements.


Syntax:


SELECT column1,column2,...columnN FROM table1
UNION
SELECT column1,column2,...columnN FROM table2;


Note : There should be equal number of columns in both SELECT statement.


UNION ALL

The only new thing about UNION ALL is that it retains the duplicates from both tables.



Syntax:


SELECT column1,column2,...columnN FROM table1
UNION ALL
SELECT column1,column2,...columnN FROM table2;