Resolved: Redundant Group by clause
As the aggregate function (AVG) is used in the context of window function, so we dont need to use the GROUP BY clause in the query. Both in the video example and in the solution, group by clause has been used in the main query. I have tried running query without the group by clause and it returns the same output. Please advise.
Thanks
Hi Tanika!
Thanks for reaching out.
Yes, when using aggregate functions as window functions with an `OVER()` clause, there's no need to use the `GROUP BY` clause in the main query to partition the data. The window function can handle the partitioning and ordering on its own. The reason the `GROUP BY` clause is used is for illustrative purposes. If your query without the `GROUP BY` clause produces the desired results, then it's correct for your specific use case.
Hope this helps.
Best,
Tsvetelin