After double checking with the documentations of Window Function and Aggregate Function, we still do not understand the full picture of this query. We sincerely appreciate if any explanation could be provided to help us further understand this first SELECT statement. Thank you.