Support the project! The site exists thanks to the community. If the help covers the expenses - the platform remains free.Support →
SQL code copied to buffer
Task 56:

Passenger Trip Analysis

Analyze the trip data from the yellow_tripdata table to gather insights based on the number of passengers. Your output should include the following columns:
- passenger_count: the number of passengers
- trip_count: the total number of trips for each passenger count
- average_distance: the average trip distance rounded to two decimal places
- median_distance: the median trip distance rounded to two decimal places
- distance_p90: the 90th percentile of trip distance rounded to two decimal places

Ensure that you filter for passenger_count values between 1 and 6 and exclude any trips with trip_distance as NULL. The results should be grouped by passenger_count and sorted in ascending order by this column.

Use DuckDB syntax to write your answer. Descriptions of tables are provided in the right pane.

Write your request in the field below and click the "Check it!" button.
Get hint
Copy code Clear editor

Hi! Could we please enable some services and cookies to improve your experience and our website?

Privacy & Cookie Policy.