+ 4
why would we use union when we can do the same using joins?
4 Answers
+ 16
union and join are completely different concepts. For union you need equal number of columns whose data types are also same. joins are much more useful and flexible. let's say you have an employee table with columns empid and deptno. you have another table department with columns deptno and deptname. if you want to find the department name for an employee you will do a join:
select employee.empid, department.deptname
from employee
join department on employee.deptno=department.deptno.
no way you can do this using union.
happy learning!!
+ 3
Union is combine of tables where as Join is to extract matching data of tables
+ 1
good explanation
0
yes UNION combines results of two or more queries into a single result.