From the course: Advanced SQL – Window Functions

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Combining grouped and window aggregate functions

Combining grouped and window aggregate functions - SQL Tutorial

From the course: Advanced SQL – Window Functions

Start my 1-month free trial

Combining grouped and window aggregate functions

- [Presenter] Look at this query and try to see if you can guess it's results. I took the liberty of providing the result of the group aggregate COUNT (*) but what is the result of the window COUNT (*) function? Pause the video for a minute and see if you can figure it out. The COUNT(*) group aggregate function evaluated each row group. It had access to the individual rows within the group and being an aggregate function, it did its magic and returned a single value, the number of rows in the group. The COUNT (*) window function doesn't have that privilege. It is not a group function and is treated like any other select expression. It does have access to all three row groups and the empty over clause makes the entire set visible to the function. So the count of all row groups is three and it's going to be true for every single group. Let's push it one step further. What will happen if I'll use COUNT (Name) instead of…

Contents