Pergunta de entrevista da empresa OneAssist Consumer Solutions

SQL queries , one puzzle question