New month, new goals. Your help keeps the project moving forward. 🖥️ Support sqltest →
SQL code copied to buffer
Task 68:

Clean Trip Dataset

DuckDB
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.
Expected result Columns: 8 · Rows: 100
tpep_pickup_datetime tpep_dropoff_datetime payment_type passenger_count trip_distance total_amount trip_duration_minutes amount_per_mile

Sample rows open after wrong checks: 0 of 2

Write your query below and click "Check it!". Tables are described in the right pane.

The query result will appear here. Ctrl+Enter - Run query

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

Privacy & Cookie Policy.