Next Insurance interview question

sql question like leetcode easy