Infosys interview question

Distinct query in SQL was easy