SQL JOINS
SQL JOINS
Then, we can create the following SQL statement (that contains an INNER
JOIN), that selects records that have matching values in both tables:
SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders
INNER JOIN Customers ON Orders.CustomerID=Customers.CustomerID;
Insert the missing parts in the JOIN clause to join the two tables Orders and Customers,
using the CustomerID field in both tables as the relationship between the two tables.
SELECT *
FROM Orders
LEFT JOIN Customers
Answer:
SELECT *
FROM Orders
LEFT JOIN Customers =;
Choose the correct JOIN clause to select all records from the two tables where there is a match in both tables.
SELECT *
FROM Orders
ON Orders.CustomerID=Customers.CustomerID;
ANSWER:
SELECT *
FROM Orders
ON Orders.CustomerID=Customers.CustomerID;
Choose the correct JOIN clause to select all the records from the Customers table plus all the
matches in the Orders table.
SELECT *
FROM Orders
ON Orders.CustomerID=Customers.CustomerID;
ANSWER:
SELECT *
FROM Orders
ON Orders.CustomerID=Customers.CustomerID;
inner join
left (Outer)
right (Outer)
full (Outer)
inner join
Inner joins combine records from two tables whenever there are
matching values in a field common to both tables. You can use INNER
JOIN with the Departments and Employees tables to select all the
employees in each department.