Pergunta de entrevista da empresa FINEXUS Group

What is the correct syntax of sql to get certain output?