Joins
A JOIN clause is used to combine rows from two or more tables in a database, based on a column that is common to them.
INNER JOIN
An inner join returns records that have identical values in both the tables.
SELECT Orders.OrderID, Customers.CustomerNameFROM Orders
INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID;
The below query will help perform an inner join on three tables.
SELECT Orders.OrderID, Customers.CustomerName, Shippe rs.ShipperNameFROM ((OrdersINNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID)INNER JOIN Shippers ON Orders.ShipperID = Shippers.ShipperID);
LEFT OUTER JOIN
A left inner join returns all the records from the left-sided table, and the matching records from the right-sided table.
SELECT Customers.CustomerName, Orders.OrderIDFROM CustomersLEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerIDORDER BY Customers.CustomerName;
RIGHT OUTER JOIN
A right inner join returns all records from the right-sided table, and the matching records from the left table.
SELECT Orders.OrderID, Employees.LastName, Employees.FirstNameFROM OrdersRIGHT JOIN Employees ON Orders.EmployeeID = Employees.EmployeeIDORDER BY Orders.OrderID;
FULL OUTER JOIN
A full outer join returns all records from both tables when there is a match in either the left-sided or the right-sided table.
SELECT Customers.CustomerName, Orders.OrderIDFROM CustomersFULL OUTER JOIN Orders ON Customers.CustomerID=Orders.CustomerIDORDER BY Customers.CustomerName;
Build apps and APIs 10x faster
Built-in authorization and caching
8x more performant than hand-rolled APIs

