T-Mobile Interview Question

How to make an code run faster for sql