Infosys interview question

bubble sort and sql queries