Hi,
QUES What is the Join in SQL Server ? What is different types of join in SQL Server ?
Loading
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.
Sam HobbsPosted Mar 19, 2012, 1:05 AM
Jignesh TrivediPosted Mar 18, 2012, 11:29 PM
with the help of Joins, we can retrieve data from two or more tables which are logical related.
On join really good article
http://dotnetslackers.com/articles/sql/SQL-SERVER-JOINs.aspx
hope this help.
SenthilkumarPosted Mar 18, 2012, 11:27 PM
There are several types of sql server.
1) inner join
2) outer join
- left outer join
- right outer join
- full outer join
3) cross join
4) self join
Inner join:
----------
The inner join is used to join the one more tables and it fetches the records when the column values matches in the specified with condition.
Products:
ProductId | ProductName | Rate | Manfacturer
Sales:
iSaleID | ProductID | Qty | Discount
If you want to join the two tables then
SELECT P.ProductID, P.ProductName, P.Manfacturer,S.iSaleID, S.Qty, P.Rate, S.Qty*P.Rate As [Total]
FROM Products P INNER JOIN Sales S ON S.ProductID = P.ProductID
Outer JOIN:
-----------
The outer join is used to map the records in the both table and remaining records in based on type of outer join used.
Suppose if we use the left outer join with products table and map with the sales table. All the matching records in the left table and unmatching records in the left table along with the null values in the right hand side table.
Cross Join:
----------
The cross join is used to generate the cartesian product. The result will be number of rows into number of columns.
SELECT * FROM Products, sales
SELECT * FROM Products CROSS APPLY Sales
You can get more information on the below urls:
http://blog.sqlauthority.com/2009/04/13/sql-server-introduction-to-joins-basic-of-joins/
http://www.mssqltips.com/sqlservertip/1667/sql-server-join-example/
Satyapriya NayakPosted Mar 18, 2012, 1:13 PM
Please refer Our recommended articles
http://www.c-sharpcorner.com/UploadFile/6cde20/concept-of-join-in-sql-server/
http://www.c-sharpcorner.com/uploadfile/c8b468/introduction-to-joins-in-sql-server/default.aspx
http://www.c-sharpcorner.com/uploadfile/raj1979/joins-in-sql-server-2005/default.aspx
Thanks