Sql Intermediate Hackerrank Solutions Algorithm