Pregunta de entrevista de Amazon

SQL medium hard question and a simple reverse a sentence string.