GlobalLogic interview question

write a program for bubble sort, write sql query using joins