When window functions are evaluated
Window functions and GROUP BY
Summary

Instruction

Great. Just as we expected, no window functions are allowed in HAVING either. Okay, you know that the remedy is to use a subquery. Try to correct the query on your own. Don't worry if you can't, the hint will be waiting for you in case you need it.

Exercise

Again, we would like to show those countries (country name and average final price) that have the average final price higher than the average price from all over the world. Correct the query by using a subquery.

Stuck? Here's a hint!

Instead of AVG(final_price) OVER() at the end, put a small subquery in there. You don't even need a window function in there, simply calculate the average from all rows.

Console

Code editor

Result

TableConsole