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
27. Exercise 2

Instruction

Keep going! Only two more exercises!

Exercise

Show the name of each couple, their preferred apartment location, and the apartment ID for all apartments that are neither in their price range nor in their preferred location.

Stuck? Here's a hint!

Type:

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