Write a sample query to retrieve user engagement metrics from a dataset.
Use the users and engagement_events tables. Include users with no engagement records, ignore events without a user ID, and treat NULL event dates as unavailable.
user_id, user_name, engagement_event_count, active_days, and last_engagement_dateuser_id ascending| Column | Type | Description |
|---|---|---|
| user_idPK | INTEGER | Unique user identifier |
| user_name | VARCHAR(100) | Display name of the user |
| country | VARCHAR(2) | Two-letter country code |
| Column | Type | Description |
|---|---|---|
| event_idPK | INTEGER | Unique engagement event identifier |
| user_id | INTEGER | User associated with the event |
| event_type | VARCHAR(20) | Type of engagement event |
| event_date | DATE | Calendar date of the event |