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
How do you migrate data from mssql server to azure?
How do I view a trc file?
Where to find ntwdblib.dll version 2000.80.194.0?
What command is used to create a database in the sql server and how?
What are a scheduled jobs or what is a scheduled tasks?
What are a database and a data warehouse?
How to remove duplicate rows from table?
What are the 10 characteristics of data quality?
Explain the categories of stored procedure i.e. System stored procedure, local stored procedure, temporary stored procedure, extended stored procedure, remote stored procedure?
What are the basic features of a trigger in ms sql server?
How to get a list of columns in a view using "sys.columns" in ms sql server?
How to convert a unicode strings to non-unicode strings?
What is bcnf normalization form?
What happens if null values are involved in datetime operations?
What are the limitations in ssrs on sql server express edition?