You're an analyst for a delivery company. Couriers deliver parcels within cities, while trucks transport them between cities. These two types of delivery legs have historically been recorded in separate tables. Before the monthly close, the finance team needs one ledger of delivery legs showing who transported each parcel and how far. Every row represents a separate billable delivery leg, so identical records must not be merged. If a courier completes the same leg twice for the same parcel, they get paid twice.
Return these columns:
- leg_source — record source: the text 'courier' for city delivery legs and 'truck' for intercity delivery legs;
- parcel_code — parcel code;
- handler_name — courier name for city delivery legs or truck driver name for intercity delivery legs;
- distance_km — delivery leg distance in kilometers, exactly as stored in the source data, without rounding.
Sort by parcel_code, then leg_source, then handler_name, then distance_km, all in ascending order. Keep duplicates: completely identical rows must appear as many times as they occur in the source tables.
leg_sourceparcel_codehandler_namedistance_kmShowing the first 3 rows of the sample — the full sample comes with Premium
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in