4
Reply

What is the differences between UNION & JOINS in sql server?

Purushottam Rathore

Purushottam Rathore

Nov 03, 2010
13.4k
0

    A 'Union selects rows' and Join 'selects columns from 2 or more tables'.

    Purushottam Rathore
    November 03, 2010
    1

    JOIN: A Join is used for displaying columns with the same or different names from different tables. The output displayed will have all the columns shown individually. i.e. The columns will be aligned next to each other. UNION: The UNION set operator is used for combining data from two tables which have columns with the same datatype. When a UNION is performed the data from both tables will be collected in a single column having the same datatype.

    Shiv kumar
    April 21, 2014
    0

    A join selects columns from 2 or more tables. A union selects rows

    Dipanshu Kumar Rana
    March 30, 2013
    0

    joins is used in our query
    like,
    SELECT column_name(s)
    FROM table_name1
    INNER JOIN table_name2
    ON table_name1.column_name=table_name2.column_name

    and union is used to merge the result of two query

    like,

    select * from table1
    union
    select * from table2

    Harshit Vyas
    November 15, 2010
    0