Pergunta de entrevista da empresa FNZ

SQL related question based on provided tables