Company: Intuit_18_jan
Difficulty: medium
Problem Description A financial technology service is conducting a comprehensive analysis of its transactions to identify areas for improvement. The company wants to generate a report detailing both successful and failed transactions, focusing on transaction volume, total amounts, and aggregated failure reasons. Write a SQL query to return the following columns: status : The status of the transaction. total_transactions : The total number of transactions for that specific status. total_amount : The sum of transaction amounts for that specific status, rounded to two decimal places (e.g., 5.00 ). failure_reasons : A comma-separated string of distinct failure reasons associated with that status. The failure_reasons string must be sorted first by the frequency (number of occurrences) of each reason in the underlying data in descending order, and then by the reason name in ascending alphabetical order. Schema transactions Table Column Name Type Description id INT The unique identifier of th