Amdocs interview question

SQL queries were difficult