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!
Window functions and GROUP BY
Summary and Review

Instruction

As you can see, the query failed. However, let's take a look at another modification of this example:

SELECT
  CategoryId,
  MAX(FinalPrice) AS MaxFinal,
  AVG(MAX(FinalPrice)) OVER() AS AvgMaxFinalPrice
FROM Auction
GROUP BY CategoryId;

What will happen now?

Exercise

Run the template.

This query succeeded because we used an aggregate function (MAX(FinalPrice)) that was indeed available after grouping the rows. By the way, this is the only place where you can nest aggregate functions inside one another.