Equi join or inner join
Non-equi join
Self join
Outer join
Cross join
Inner join : join the table based on the common column(s) available in both the tables.
ex
select e.ename,d.dname from emp e inneroin department d on d.deptno=e.deptno
non-equi join: joining 2 tables not based on the common column.
ex
select e.name,g.grade from emp e innerjoin grade g on e.sal between e.lowsal and e.highsal
self join: Joining a table to itself is known as self join
it is performed if it has self referential intigrity
ex
select x.ename,y.ename as mgrname from emp x join emp y on x.managerid=y.empid
outer join : returns unmatched records from the tables.
Left outer join and right outer join
cross join: It returns cross product of 2 tables.
if we submit the select statement with out join condition then sql server performs cross join.
select e.ename, d.dname from emp e dept d
Non-equi join
Self join
Outer join
Cross join
Inner join : join the table based on the common column(s) available in both the tables.
ex
select e.ename,d.dname from emp e inneroin department d on d.deptno=e.deptno
non-equi join: joining 2 tables not based on the common column.
ex
select e.name,g.grade from emp e innerjoin grade g on e.sal between e.lowsal and e.highsal
self join: Joining a table to itself is known as self join
it is performed if it has self referential intigrity
ex
select x.ename,y.ename as mgrname from emp x join emp y on x.managerid=y.empid
outer join : returns unmatched records from the tables.
Left outer join and right outer join
cross join: It returns cross product of 2 tables.
if we submit the select statement with out join condition then sql server performs cross join.
select e.ename, d.dname from emp e dept d
No comments:
Post a Comment