#33
Merchant Delivery Radius Segmentation
EASYAggregationPOSTGRESQL
Problem Description
You are analyzing merchant service coverage for a food delivery platform. Given a table of merchants with their delivery radius in kilometers, segment them into three categories and count how many merchants fall into each.
**Segments (using `delivery_radius` column):**
- `'< 6'` — delivery_radius < 6
- `'6-10'` — delivery_radius >= 6 AND delivery_radius <= 10
- `'10+'` — delivery_radius > 10
**Output columns:** `delivery_radius_bucket`, `num_of_merchants`
Return results ordered by segment sequence (`'< 6'` first, then `'6-10'`, then `'10+'`). Count all merchants regardless of active status.
Topics
aggregationbucketingcase whengroup by
Asked at Companies
doordash
Solve This Problem
Sign up to access the interactive code editor, run test cases, view the editorial, and get AI-powered feedback on your solution.
Start Solving →