Good reference solution to problem 2 (database)