You are given seller order data from a marketplace. Write a PostgreSQL query that identifies the sellers whose revenue is growing fastest month over month, based on the largest percentage increase in the latest month compared with the previous month. Return one row per seller with their latest month, previous month revenue, growth amount, and growth rate, then rank sellers from highest to lowest growth rate.
Use window functions to compare each seller’s monthly revenue to the prior month. Exclude sellers who do not have revenue in both months needed for the comparison.
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Primary key for each order |
| seller_id | INT | Unique seller identifier |
| seller_name | VARCHAR(255) | Seller display name |
| order_date | DATE | Date the order was completed |
| order_revenue | DECIMAL(10,2) | Revenue from the order |