Joins In SQL SERVER
What are Joins in SQL Server and how we can implement them?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Shivanand ArurPosted Sep 25, 2012, 7:23 AM
Lets say that we have 2 tables "Employee" and "Departments"
"Employee" table contains 3 columns
Table Name: Employee Table Name: Department
EmpID Name Profile DeptID DeptName deptCity Profile
01 Shiv S/w Eng 001 IT Chennai S/w Eng
02 Anand Manager 002 Purchase Mumbai Manager
03 Aahan Manager 003 HR Mumbai Manager
Now if you want to get information about the Employee and the Departname in which they work, you can get it through Joins...
"Select Emp.Name, Emp.Profile, Dept.deptCity from Employee Emp, Department Dept JOIN Department Dept ON EMP.Profile = Dept.Profile".
This was just a sample example to explain you. There are various types of JOINS which are as follows:
1. Inner Join: (Refer this site)
http://www.1keydata.com/sql/inner-join.html
2. Outer Join: (Refer this site)
http://www.1keydata.com/sql/sqlouterjoin.html
3. Left Outer Join: (Refer this site)
http://www.1keydata.com/sql/left-outer-join.html
4. Cross Join: (Refer this site)
http://www.1keydata.com/sql/cross-join.html
HOPE this helps you!!!
PLEASE MARK THE ANSWER AS ACCEPTED IF IT HELPED