Welcome to the SQL screen.
The question is on your right: First and Last User Events. Read through the requirements and the three tables first.
Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?
StreamWave tracks user activity across web and mobile sessions. Write a PostgreSQL query to return each active user's first and last event based on event timestamp.
status is 'active'.event_id for the first event and the larger event_id for the last event.user_id.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Primary key for the user |
| full_name | VARCHAR(100) | User full name |
| status | VARCHAR(20) | Account status such as active, inactive, or banned |
| signup_date | DATE | Date the user signed up |
| Column | Type | Description |
|---|---|---|
| platform_idPK | INT | Primary key for the platform |
| platform_name | VARCHAR(50) | Platform name such as web or ios |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Primary key for the event |
| user_id | INT | User who generated the event |
| platform_id | INT | Platform where the event occurred |
| event_type | VARCHAR(50) | Type of event |
| event_time | TIMESTAMP | Timestamp when the event occurred |