Write a SQL query to identify customers whose usage has dropped by more than twenty percent month-over-month.
Use the customers and usage_events tables. Compare each customer's total usage for a calendar month with the immediately preceding calendar month. Exclude customers without usage in both months and cases where the prior month's usage is zero or unavailable.
customer_id, customer_name, current_month, prior_month_usage, current_month_usage, and drop_percentage.customer_id and current_month ascending.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(150) | Customer display name |
| Column | Type | Description |
|---|---|---|
| usage_event_idPK | INT | Unique usage event identifier |
| customer_id | INT | Customer associated with the usage event |
| usage_date | DATE | Date on which usage was recorded |
| usage_units | INTEGER | Units consumed during the event |