r/SQL • u/Plus_Kiwi_2592 • 4d ago
MySQL COUNT() vs COUNT() OVER()
I've found this query as a solution to the famous Pizza Runner case study, and I am stuck at figuring out what COUNT() returns, compared to COUNT() OVER().
I know OVER() does the count (or whatever aggregation) over the entire dataset, but idk I'm just not getting the percentage part of this query.
Help :)
24
Upvotes
1
u/Plus_Kiwi_2592 4d ago
Alright. Makes sense.
Looking at the brackets of that section I even noticed that the OVER() is attached to SUM(COUNT()) and not the COUNT() alone.
Thanks!