Klar interview question

Optimize a SQL query and how would I filter some data using Python