Company: Amazon_10sep
Difficulty: medium
Problem Description The Data Science Team at Amazon is facing a unique challenge. A portion of their data has gone missing from their database. However, they believe they can recover the lost data based on the following criteria: The missing data is a permutation of the characters found in the string first_info . The missing data is lexicographically strictly greater than the string second_info . The missing data is the lexicographically smallest string that satisfies the above two conditions. In other words, they are searching for the smallest valid permutation that meets these criteria. If no such string can be formed, the result should be '-1' . Schema Table Name: info_data id (INTEGER): A unique identifier for each test case. first_info (VARCHAR): The string containing the characters available for the missing data. second_info (VARCHAR): The string that the missing data must be lexicographically greater than. Required Output Write a SQL query to find the missing data for each recor