Amdocs interview question

sql query