Pergunta de entrevista da empresa Russell Investments

what would be the sql script for this?