GoTo Interview Question

How to enhance the DB queries?