🙏 Thank you for your support last month! Thanks to you, the project keeps growing. We'd be grateful if you could support us again this month. Support again →
SQL code copied to buffer
Task 59:

Trip Cost Quantiles

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.

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.