Your question is Compare Seller Performance Before and After Onboarding. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
You are given seller onboarding records and order activity. Write a PostgreSQL query that compares each seller’s performance before and after their onboarding change date, and returns the change in average order value and order count across the two periods.
Use the seller’s onboarding change date as the cutoff: orders on or after that date belong to the after period, and orders before it belong to the before period. Return only sellers who have at least one order in both periods.
| Column | Type | Description |
|---|---|---|
| seller_idPK | INT | Unique seller identifier |
| seller_name | VARCHAR(255) | Seller display name |
| onboarding_change_date | DATE | Date the onboarding change started for the seller |
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique order identifier |
| seller_id | INT | Seller who placed the order |
| order_date | DATE | Date the order was placed |
| order_amount | DECIMAL(10,2) | Gross value of the order |