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.couple_name,
  couples.pref_location,
  apartments.id
FROM couples
JOIN apartments
  ON apartments.price NOT BETWEEN couples.min_price AND couples.max_price
  AND location != pref_location