Average Commute Time
Start Timer
0:00:00
Let’s say you work at Uber. The rides table contains information about the trips of Uber users across America
Write a query to get the average commute time (in minutes) for each commuter in New York (NY) and the average commute time (in minutes) across all commuters in New York.
Example:
Input:
rides table
| Column | Type |
|---|---|
id |
INTEGER |
commuter_id |
INTEGER |
start_dt |
DATETIME |
end_dt |
DATETIME |
city |
VARCHAR |
Output:
| Column | Type |
|---|---|
commuter_id |
INTEGER |
avg_commuter_time |
FLOAT |
avg_time |
FLOAT |
Display results like:
commuter_id |
avg_commuter_time |
avg_time |
|---|---|---|
| 11 | 27 | 45 |
| 22 | 97 | 45 |
| 33 | 11 | 45 |
.
.
.
.
.
.
.
.
.
Comments