Microsoft Store analysts receive revenue data from multiple reporting systems, so the same value may contain currency symbols, commas, whitespace, or invalid text. Write a PostgreSQL query to prepare the revenue column for analysis.
raw_revenue by removing currency symbols, commas, and surrounding whitespace, then cast valid values to NUMERIC(12,2).NULL for missing or invalid revenue values, and order the results by sale_id.| Column | Type | Description |
|---|---|---|
| sale_idPK | INTEGER | Unique sale identifier |
| product_name | VARCHAR(100) | Microsoft Store product name |
| raw_revenue | VARCHAR(30) | Revenue received as unprocessed text |