Hackerrank Sql Intermediate Question