Amdocs Interview Question

SQL question to match the input