Pregunta de entrevista de FNZ

To optimize an obviously bad SQL query, to code a simple class in C#