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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Mar 18, 2012, 9:13 AM EDT
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
SenthilkumarRank #387 · 6.5K reputationPosted Mar 18, 2012, 7:27 PM EDT
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/
Jignesh TrivediRank #16 · 50.3K reputationPosted Mar 18, 2012, 7:29 PM EDT
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.
Sam HobbsRank #107 · 20.5K reputationPosted Mar 18, 2012, 9:05 PM EDT