MaxAB interview question

Problem solving Database queries System design