Rakuten Interview Question

how can u deal with multiple queries in db?