Wrote query for question 3