What are the differences between UNION and JOINS?
Answer Posted / 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 View All Answers
Explain transaction server explicit transaction?
What is the difference between executequery () and executeupdate ()?
whats the maximum size of view state??
What do you understand by hotfixes and patches in sql server?
How can we improve performance by using SQL Server profiler?
What are commonly used mssql functions in php?
What is an sql server agent?
Please explain what is “asynchronous” communication in sql server service broker?
What is log cache in sql server?
mention different types of relationships in the dbms?
How to configure and test odbc dsn settings?
What are the steps to process a single select statement?
List the data types available in mssql?
What do you need to connect php to sql server?
List out different types of normalizations in sql server and explain each of them?