Below is a Example for SQL inner join, SQL Left Join and SQL Right Join.
Table B SQL inner join Example for SQL inner join - Join more than 1 table to get other table data 1. SELECT A.Name, B.Product FROM A INNER JOIN B ON A.GuestID=B.GuestID Result :
Another example which can be tried on SQL SERVER 2005 sample database AdventureWorks is to find products that are supplied by more than one vendor. Please refer the sample database for table structure.
USE AdventureWorks;
GO
SELECT
DISTINCT
pv1.ProductID, pv1.VendorID
FROM
Purchasing.ProductVendor pv1
INNER
JOIN
Purchasing.ProductVendor pv2
ON
pv1.ProductID = pv2.ProductID
AND
pv1.VendorID = pv2.VendorID
ORDER
BY
pv1.ProductID