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

Trip Cost Quantiles

DuckDB
Write a query to analyze the payment types used in taxi trips. Your output should include the following columns:
- payment_type: the type of payment used
- trip_count: the total number of trips for each payment type
- approximate_median_amount: the approximate median total amount for each payment type, rounded to two decimal places
- approximate_p90_amount: the approximate 90th percentile total amount for each payment type, rounded to two decimal places

Ensure that you only include records where both payment_type and total_amount are not null. The results should be grouped by payment_type and sorted in ascending order by this column.
Expected result Columns: 4 · Rows: 5
payment_type trip_count approximate_median_amount approximate_p90_amount

Sample rows open after wrong checks: 0 of 3

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.