Practice Interview Questions
| Question | Status |
|---|---|
Calculate the average time each user spent in a session.
A session means the time between a 'page_load' and 'page_exit' event. If a user has multiple identical events in a day, pick the latest 'page_load' and earliest 'page_exit', making sure the 'page_load' happens before 'page_exit'.
user_actions table:
| Column Name | Description |
|---|---|
| user_id | User performing the action |
| timestamp | Time when the action occurred |
| action | Type of action performed |
| user_id |
|---|
| 15 | 1883.5 |
| 19 | 35.0 |
Calculate the average time each user spent in a session.
A session means the time between a 'page_load' and 'page_exit' event. If a user has multiple identical events in a day, pick the latest 'page_load' and earliest 'page_exit', making sure the 'page_load' happens before 'page_exit'.
user_actions table:
| Column Name | Description |
|---|---|
| user_id | User performing the action |
| timestamp | Time when the action occurred |
| action | Type of action performed |
| user_id | avg_session_time |
|---|---|
| 15 | 1883.5 |
| 19 | 35.0 |