Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
Basic CTE
11. Multiple CTEs - practice 2


Excellent. Now, let's do another kind of exercise with multiple CTEs where you will have to use a JOIN in the outer query.


For each person who made donations in 'music' or 'traveling' categories, show three columns:

  • supporter_id,
  • min_music - that person's minimum donation amount in the music category,
  • max_traveling - that person's maximum donation amount in the traveling category.

Stuck? Here's a hint!

First, you should use CTE to find all users that donated to either music or traveling projects. Then, use two CTEs, one for finding the minimum for music category, the other one for finding the maximum in traveling category. In each CTE, select the supporter_id as well. In the outer query, join all your CTEs results on the supporter_id. In order to show all the results use LEFT JOIN.