What is your experience with SQL window functions? Can you provide an example?
Provide a PostgreSQL query using the supplied customer and order data. Calculate each customer's completed-order spending and position customers from highest to lowest, including customers with no completed orders.
customer_id, customer_name, total_spend, and spending_rank.0 total spend. Ignore orders whose amount is NULL.spending_rank, then customer_id.| Column | Type | Description |
|---|---|---|
| customer_idPK | INTEGER | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| Column | Type | Description |
|---|---|---|
| order_idPK | INTEGER | Unique order identifier |
| customer_id | INTEGER | Customer who placed the order |
| amount | NUMERIC(12,2) | Order amount; NULL amounts are ignored in totals |
| status | VARCHAR(40) | Order processing status |