sql server full outer join code example

Example 1: full join sql

#The FULL JOIN keyword return rows when there is a match in one of the tables
synatax->SELECT column_name(s)
FROM table_name1
FULL JOIN table_name2
ON table_name1.column_name=table_name2.column_name 
/////example////
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons
FULL JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName

Example 2: full outer join sql

SELECT C.FirstName, C.LastName, C.Country AS CustomerCountry,        S.Country AS SupplierCountry, S.CompanyName  FROM Customer C FULL JOIN Supplier S     ON C.Country = S.Country ORDER BY C.Country, S.Country

Tags:

Sql Example