Write a SQL query to identify customers who have experienced a sudden drop in sync volume of more than 50% compared to their trailing 30-day average at Fivetran.
Assume multiple observations for the same customer and date should be combined, and the comparison excludes the current date. Use the available observations from the preceding 30 calendar days; customers with no valid or zero baseline should not be reported.
customer_id, customer_name, sync_date, sync_volume, trailing_30_day_avg, and drop_percentagesync_date ascending and customer_id ascending| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique Fivetran customer identifier |
| customer_name | VARCHAR(100) | Customer display name |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique sync activity identifier |
| customer_id | INT | Customer associated with the sync activity |
| sync_date | DATE | Date of the sync observation |
| sync_volume | INT | Number of records synchronized |