Infosys Interview Question

was asked to solve an rdms nested query