Amazon interview question

It is about database problem.