Next Insurance Interview Question

Sql need groupby, windows function etc