Vadatech Inc. interview question

How to optimize the database queries?