Mphasis Interview Question

I was asked about SQL quries and a program to solve, which was pretty simple.