Write a T-SQL query using a Common Table Expression (CTE) to find the running total of sales for each region.
Use all sales records and treat each region and sale date as one reporting row. The submitted solution must use PostgreSQL-compatible SQL.
region, sale_date, daily_sales, and running_total.region ascending with NULL regions last, then sale_date ascending.| Column | Type | Description |
|---|---|---|
| sale_idPK | INT | Unique identifier for the sale |
| region | VARCHAR(50) | Sales region |
| sale_date | DATE | Date when the sale occurred |
| sales_amount | NUMERIC(12,2) | Sales amount for the transaction |