Q. You want to retrieve all customers from the Customers table, and for those who have placed orders, you also want to see their order information from the Orders table. Customers who have not placed orders should still be included in the result. Which join should you use?

A
SELECT * FROM Customers INNER JOIN Orders ON Customers.ID = Orders.CustomerID
B
SELECT * FROM Customers LEFT JOIN Orders ON Customers.ID = Orders.CustomerID
C
SELECT * FROM Customers RIGHT JOIN Orders ON Customers.ID = Orders.CustomerID
D
SELECT * FROM Customers FULL JOIN Orders ON Customers.ID = Orders.CustomerID
Solution:

A LEFT JOIN is appropriate here because you want all customers (the left table) regardless of whether they have a matching record in the orders table (the right table).

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!