Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Medical Center database
Non primary-foreign key JOINs
Non-equi JOINs
Non-equi self JOINs
Summary

Instruction

Amazing! How about this one?

Exercise

For each couple that wants an apartment, show their name with matching apartment IDs and locations for all apartments that are within their price range and in their preferred location.

Stuck? Here's a hint!

Type:

SELECT
  Couples.CoupleName,
  Apartments.Id,
  Location
FROM Couples
JOIN Apartments
  ON Apartments.Price BETWEEN Couples.MinPrice AND Couples.MaxPrice
WHERE Apartments.Location = Couples.PrefLocation