Medical Center database
Non primary-foreign key JOINs
Non-equi JOINs
14. Filtering non-equi-JOINs
Non-equi self JOINs
Summary

Instruction

Good! How about filtering our query?

Exercise

For every buyer that has funds greater than 10 000, show the name of the buyer and the names of the items they can afford that are not of the 'painting' type.

Stuck? Here's a hint!

Type:

SELECT
  b.name,
  i.name
FROM item i
JOIN buyer b  
  ON i.price <= b.funds
WHERE i.type != 'painting'
  AND b.funds > 10000

Console

Code editor

Result

TableConsole