Brillio Interview Question

few mysql queries and puzzles