Pregunta de entrevista de Roche

permutation of string, SQL question and another string problem