Bell interview question

how to solve the problem about database