Amdocs interview question

sql, programming, one tricky question