Bloomberg interview question

write sql queries for given problems