Infosys interview question

To write a script for database query