🎯 Few days left this month Support SQLTest.online and help us keep SQL practice free for everyone. Donate today →
SQL code copied to buffer
Task 16:

Data Quality Analysis

DuckDB
Analyze the yellow_tripdata table to identify and quantify various data quality issues. Your output should include the following columns:
- total_rows: Total number of rows in the dataset
- missing_pickup_count: Count of rows with missing tpep_pickup_datetime
- missing_dropoff_count: Count of rows with missing tpep_dropoff_datetime
- invalid_distance_count: Count of rows with invalid trip_distance
- invalid_amount_count: Count of rows with invalid total_amount
- invalid_passenger_count: Count of rows with invalid passenger_count
- invalid_time_count: Count of rows with invalid time data
- problematic_row_count: Count of rows with any quality issues
- clean_row_percentage: Percentage of rows without quality issues, rounded to two decimal places
Expected result Columns: 9 · Rows: 1
total_rows missing_pickup_count missing_dropoff_count invalid_distance_count invalid_amount_count invalid_passenger_count invalid_time_count problematic_row_count clean_row_percentage

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

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