Write a SQL query to identify users whose request volume spikes sharply compared with their own historical baseline in Hiddenlayer’s data warehouse.
Use January through March 2025 as the historical baseline and April 2025 as the current month. A spike is a current-month request count at least twice the user’s average monthly baseline, with a positive baseline average.
user_id, email, current_month_requests, baseline_avg_requests, and spike_ratio.spike_ratio descending, then user_id ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique identifier for a user |
| VARCHAR(255) | User email address |
| Column | Type | Description |
|---|---|---|
| request_idPK | INT | Unique identifier for a request event |
| user_id | INT | User associated with the request |
| requested_at | TIMESTAMP | Timestamp when the request occurred |