Amdocs interview question

Collection framework, Codes on Strings and Patterns. One or two Sql queries on the given situation.