Appinventiv Interview Question

7 : Self join query