State Street interview question

How would you go about solving this problem in SQL?