Evaluation Order and Common Problems
Window functions and GROUP BY
12. Practice Time!
Summary and Review

Instruction

Okay. The best way to correctly create queries with window functions and GROUP BY is as follows: first, create the query with GROUP BY, but without window functions. Run the query (in SQL Server or in your head). Now, the columns you see in the result are the only columns you can use in your window functions.

Exercise

Group the auctions by the Country. Show the country, its minimal number of participants in an auction and the average minimal number of participants across all countries. Name the last columns MinParticipants and AvgMinParticipants.

Stuck? Here's a hint!

Use

AVG(MIN(Participants)) OVER()

as your window function.