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!
Nested CTEs


Excellent! Let's do one more exercise of this kind.


Count the maximal amount_earned on a given day in a given city. Then, calculate the average maximal amount across all cities on a given day. Finally, count the number of days on which that average maximal exceeded $1700.

Stuck? Here's a hint!

Use MAX(amount_earned) in the first CTE, the use AVG on that aggregate result. In the outer query, use COUNT.