Write a SQL query to join these tables and aggregate user behavior by time interval.
Use the provided user and behavior event data. Summarize activity in hourly intervals, retain users with no matching events, and treat missing duration values as zero.
user_id, user_name, time_interval, behavior_count, total_duration_seconds, and distinct_event_typesuser_id, then time_interval ascending, with missing intervals last| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique user identifier |
| user_name | VARCHAR(100) | User display name |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique behavior event identifier |
| user_id | INT | User associated with the event |
| occurred_at | TIMESTAMP | Timestamp when the behavior occurred |
| event_type | VARCHAR(50) | Type of behavior event |
| duration_seconds | INT | Duration associated with the event in seconds |