Chubb interview question

How will u write this query in SQL?