Write a SQL query to track onboarding progress by client, including shipment counts, delay rates, and 30-day trend changes across accounts.
Use the data through April 30, 2024. A shipment is delayed when it was delivered after its promised date or remains undelivered after its promised date. Compare March 31 through April 29 with March 1 through March 30.
client_id, client_name, onboarding_status, total and delayed shipment counts, overall delay rate, current and prior 30-day shipment counts, shipment count change, and delay-rate change in percentage points.client_id ascending. Return rates rounded to two decimal places.| Column | Type | Description |
|---|---|---|
| client_idPK | INT | Unique client identifier |
| client_name | VARCHAR(100) | Client account name |
| onboarding_status | VARCHAR(30) | Current onboarding status |
| Column | Type | Description |
|---|---|---|
| shipment_idPK | INT | Unique shipment identifier |
| client_id | INT | Client associated with the shipment |
| shipment_date | DATE | Date the shipment was created |
| promised_delivery_date | DATE | Promised delivery date |
| delivered_date | DATE | Actual delivery date, or NULL if not delivered |