Your question is SQL: Min and Max Per User. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Robinhood monitors access to resources in the Robinhood app, such as account statements and tax documents. Write a PostgreSQL query that reports each user’s earliest and latest recorded access time.
first_access_at and latest access as last_access_at using timestamp aggregation.user_id ascending.NULL values for users whose access history is unavailable.| Column | Type | Description |
|---|---|---|
| user_idPK | BIGINT | Unique Robinhood user identifier |
| username | VARCHAR(100) | User display name |
| account_status | VARCHAR(20) | Current account status |
| Column | Type | Description |
|---|---|---|
| access_idPK | BIGINT | Unique access event identifier |
| user_id | BIGINT | User associated with the access event |
| resource_name | VARCHAR(100) | Robinhood resource accessed |
| accessed_at | TIMESTAMPTZ | Timestamp when the resource was accessed |
| event_type | VARCHAR(30) | Access event type |