Wrote query for question 2