Ergeon interview question

Database query optimizations, time complexity, write small code.