IBM Interview Question

One programming and one SQL problem.