Write a SQL query to calculate monthly operational volume and compare it to the prior month.
Use operational_events and operation_types. Include only events with a valid operation type and a non-null event date. Treat the prior month as the preceding reported month for the same operation type.
operation_type, monthly_period, monthly_volume, prior_month_volume, volume_change, and percent_change.operation_type, then monthly_period.| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique operational event identifier |
| operation_type_id | INT | Referenced operation type |
| event_date | DATE | Date on which the operational event occurred |
| Column | Type | Description |
|---|---|---|
| operation_type_idPK | INT | Unique operation type identifier |
| operation_name | VARCHAR(100) | Name of the operational activity |