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

Clean Trip Dataset

Prepare a cleaned trip dataset for further analysis. Keep only records with the following criteria:
- Records with specified timestamps
- tpep_dropoff_datetime is not earlier than tpep_pickup_datetime
- trip_distance is positive
- total_amount is nonnegative
- passenger_count is positive

Replace a missing payment_type with Unknown. Add trip duration in minutes and trip cost per mile. Return the first 100 cleaned records.

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.