Amazon Development Center U.S. product analytics needs a daily engagement report for an internal product surface. Write a PostgreSQL query that calculates daily active users and next-day retention from registered-user activity.
NULL for the retention rate on the final activity date because no following day is available.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Registered user identifier |
| display_name | VARCHAR(100) | User display name |
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity event identifier |
| user_id | INT | User who generated the activity |
| activity_date | DATE | Calendar date on which the activity occurred |
| event_type | VARCHAR(30) | Type of product activity |