Pregunta de entrevista de Comeet

Optimize a SQL query. It was about 15 lines of code.