For those who don’t know what window function is and how it works, let’s understand it. Window function applies aggregate like sum(), avg(), count() and ranking functions rank(), dense_rank(), row_number() over a particular window i.e set of rows it is followed by OVER clause. OVER clause is used with window…