Infosys interview question

They have asked to write Query for a given scenario.