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 14:

Trip Distance Histogram

Create a query that generates a histogram of trip distances for each pickup location in the yellow_tripdata table. Your output should include the following columns:
- PULocationID: The ID of the pickup location.
- distance_histogram: A histogram representing the distribution of trip_distance values within specified buckets.

Ensure that you filter out records where PULocationID is NULL and trip_distance is less than or equal to 0. Group the results by PULocationID and sort the output by this column in ascending order, limiting the results to 100 entries.

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.