SQL UNION Operator

The UNION operator is used to combine the results of two or more SELECT statements and return the value without any duplicate values. To use this operator in the SELECT Statements, the SELECT should have –

  • Every SELECT statement should have an equal number of columns.
  • The data type should be the same for each column.
  • The columns of each SELECT statement should have the same order.
  • Syntax of  UNION Operator –

SELECT column1,column2,column3,...,columnN
FROM Table A
UNION
SELECT column1,column2,column3,...,columnN
FROM Table B;

 

  • Syntax of  UNION ALL  – 

The UNION ALL is similar to UNION, but the only difference is that UNION ALL returns duplicate values.

SELECT column1,column2,column3,...,columnN
FROM Table A
UNION ALL
SELECT column1,column2,column3,...,columnN
FROM Table B;

 

Follow us on TwitterFacebookLinkedin, and Tableau Public to stay updated with our latest blog and what’s new in Tableau.

 Automate data analysis pipeline and create report ready dashboards

If you are looking forward to getting your data pipeline built and setting up the dashboard for business intelligence, book a call now from here.

#analytics #data #business #artificialintelligence #machinelearning #startup #deeplearning #deeplearning #datascience #ai #growth #dataanalytics #india #datascientist #powerbi #dataanalysis #tableau #SQL #businessanalytics #businessanalyst #businessandmanagement #dataanalyst #businessanalysis #analyst #analysis #powerbideveloper #powerbidesktop #letsviz