Bell Interview Question

how to solve the problem about database