T-SQL/MSBI Knowledge Share Videos

Examples on T-SQL Joins

Inner Join
In the below example you can see that the record with Emp_Id='E007' and Dep_Id ='D003' is eliminated from the output result, since they dont have a match between the tables.
 


Left Outer Join
In the below example output you can see that all record in the employee table is displayed but Dep_Id ='D003' is eliminated from the output result.


Right Outer Join
In the below example output you can see that all record in the dept table is displayed but Emp_Id ='E007' is eliminated from the output result.


Full Outer Join
In the below example output you can see that all record dept table and employee table is displayed.


Cross Join



Self Join
Here we join the same table on different columns. Note that the order of columns using in the join matters a lot i.e, e.Emp_manager=m.Emp_Id is different from e.Emp_Id=m.Emp_manager.





No comments: