Company: Intuit_6march
Difficulty: medium
Problem Description You have been tasked with writing a SQL query to calculate the total market capitalization of companies within their respective stock market sectors. Because the data is gathered from multiple sources, it requires cleaning, parsing, and formatting. You must filter out invalid records, convert string-based capitalization values into numeric formats, calculate the total capitalization per sector, and then format the aggregated total back into a standardized string. Schema Table: companies Column Name Data Type Description name VARCHAR The name of the company. (Primary Key) sector VARCHAR The company's stock sector (e.g., 'Finance', 'Technology'). capitalization VARCHAR The company's capitalization, formatted as a string (e.g., '$10.51B', '$192.68M'). Required Output The query should return a result set with the following columns: sector : The stock sector. total_capitalization : The aggregated total capitalization of all valid companies in that sector, formatted as a