PA Consulting wants a monthly view of its highest-value client accounts. Write a PostgreSQL query that calculates completed-order revenue for each client and returns the top three clients in every month.
customers to orders using customer_id.status = 'completed' and group revenue by calendar month and client.YYYY-MM, client name, total revenue, and monthly rank, ordered by month and rank.| Column | Type | Description |
|---|---|---|
| customer_idPK | INTEGER | Unique client identifier |
| customer_name | VARCHAR(120) | Client account name |
| Column | Type | Description |
|---|---|---|
| order_idPK | INTEGER | Unique order identifier |
| customer_id | INTEGER | Client associated with the order |
| order_date | DATE | Date the order was placed |
| amount | NUMERIC(12,2) | Order revenue |
| status | VARCHAR(20) | Order processing status |