Medical Center database
Non primary-foreign key JOINs
Non-equi JOINs
17. Get apartments in price range
Non-equi self JOINs
Summary

Instruction

Okay, let's try some exercises!

Exercise

For every couple that has an apartment, show their name together with the IDs of all apartments within their price range.

Stuck? Here's a hint!

Type:

SELECT
  couples.couple_name,
  apartments.id
FROM couples
JOIN apartments
  ON apartments.price BETWEEN couples.min_price AND couples.max_price

Console

Code editor

Result

TableConsole