Wrote query for question 4