Infosys Interview Question

self join query