How would you pivot and unpivot the same table in Alteryx and in SQL?
Use the sales_matrix table below. Write SQL that returns the pivoted result, then write SQL that converts that pivoted result back to the original row format.
region with separate columns for each product_name.region and product_name pair with the corresponding sales_amount.region, then product_name where applicable.| Column | Type | Description |
|---|---|---|
| sales_idPK | INT | Unique row identifier |
| region | VARCHAR(50) | Sales region |
| product_name | VARCHAR(50) | Product name |
| sales_amount | INT | Sales amount for the region and product |