Bank of America Interview Question

Optimize the given SQL query