Amdocs interview question

SQL query, python code, test case.