RBC interview question

Coding a lot of sql queries