Ericsson interview question

SQL query