Pergunta de entrevista da empresa Chamberlain Group

How SQL proceed with it's logic