Infosys Interview Question

Dsa and sql and one puzzle