eClerx Interview Question

How to optimize a query