Bridgewater Associates interview question

Coding Task, Basic SQL Queries