What are the differences between UNION and JOINS?

Answers were Sorted based on User's Feedback



What are the differences between UNION and JOINS?..

Answer / saravakumar

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

Is This Answer Correct ?    7 Yes 0 No

What are the differences between UNION and JOINS?..

Answer / sree

UNION:The SQL UNION operator combines two or more SELECT
statements.

JOINS:SQL joins are used to query data from two or more
tables, based on a relationship between certain columns in
these tables.

Is This Answer Correct ?    4 Yes 0 No

What are the differences between UNION and JOINS?..

Answer / nikhila reddy

UNION:the both tables should have same structure and datatype.
the column name will taken as first table ones it wont bother abt other tables.
example:
emp table as
eid ename esal
1 a 10k
2 b 20k

dept table as
deptid deptname deptsal
11 aa 20k
12 bb 50k


select * from emp
union
select * from dept

empid empname empsal
1 a 10k
2 b 20k
11 aa 20k
12 bb 50k

now u can observe col name taking alias of first table.
no need of relation between a tables.
it will remove duplicate records.


joins:it will join only required fields from different tables.
no need of same structure for tables..
it should have relation between a tables.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What type of Index will get created after executing the above statement?

0 Answers  


Is there any difference between the primary key and unique key?

0 Answers  


Can you name some of the dml commands in sql?

0 Answers  


hi, i have a table called names and field name select * from names name a b c d i want to display like this name a,b,c,d how it is possible Regards Baiju

4 Answers  


What are the differences between left join and inner join in sql server?

0 Answers  






What is the use of stored procedure?

0 Answers  


what is the query and condition to delete datas in sql server.

2 Answers  


Can you index views?

0 Answers  


Explain “not null constraint” in sql server?

0 Answers  


How to Handle the exceptions in Sqlsrver 2005??

3 Answers   Value Labs, Wipro,


Explain few of the new features of sql server 2008 management studio

0 Answers  


How efficient you are in oracle and SQL server?

0 Answers   CGI,


Categories