Amdocs Interview Question

Sql query