Fidelity Investments interview question

Given a scenario, write the correct query.