Course Content
SQL SERVER
About Lesson

/*
Join – Fetch Data from more than one table.

Cross Join – Number of Rows of 1st Table X Number of Rows of 2nd Table
Inner Join – It is also known equiy join.
in on we match primary key field of parent table with foreign key field of child table.
Left Join
Right Join
Full Join
Self Join
*/
select * from tbldept;
select * from tblemp;

select * from tbldept
cross join tblemp;

select e.eno,e.ename,e.job,e.sal,e.Hiredate,d.DName
from tbldept d
inner join tblemp e on d.DNo=e.DNo;

select e.eno,e.ename,e.job,e.sal,e.Hiredate,d.DName
from tbldept d
left join tblemp e on d.DNo=e.DNo;

select e.eno,e.ename,e.job,e.sal,e.Hiredate,d.DName
from tbldept d
right join tblemp e on d.DNo=e.DNo;

select e.eno,e.ename,e.job,e.sal,e.Hiredate,d.DName
from tbldept d
full join tblemp e on d.DNo=e.DNo;

select e.ENo,e.EName,e.Job, m.EName Manager,m.Job
from tblemp e join tblemp m
on e.MgrId=m.ENo;

–select e.eno,e.Job,e.Sal,s.grade
–from tblemp e, tblsalgrade s where e.Sal >=s.minsal and e.sal<=s.maxsal;