MindGate Solutions interview question

Sql query and few basic things