Pergunta de entrevista da empresa UST

Given an input and output and to write few SQL queries ( mainly of Case statement , using substring, CAST and all )