Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Trade Lane Shipment Performance SQL
00:00
5 left

Trade Lane Shipment Performance SQL

MediumSQL · PostgreSQL

Problem

Write a SQL query to analyze shipment performance by trade lane at Phoenix International Freight Services by joining shipments, customers, and carrier tables to calculate on-time delivery rate, average transit time, and monthly volume.

Use delivered 2024 shipments with complete shipment dates, and exclude canceled or unmatched records.

Output

  1. One row per trade lane, carrier, and shipment month.
  2. Columns: trade_lane, carrier_name, shipment_month, on_time_delivery_rate_pct, average_transit_days, monthly_volume, and previous_month_volume.
  3. Sort by trade lane, carrier, and month ascending.

Schema

shipments
ColumnTypeDescription
shipment_idPKINTUnique shipment identifier
customer_idINTCustomer associated with the shipment
carrier_idINTCarrier assigned to the shipment
trade_laneVARCHAR(100)Origin and destination trade lane
ship_dateDATEDate the shipment departed
promised_delivery_dateDATECommitted delivery date
actual_delivery_dateDATEActual delivery date
statusVARCHAR(30)Shipment lifecycle status
customers
ColumnTypeDescription
customer_idPKINTUnique customer identifier
customer_nameVARCHAR(120)Customer legal or trading name
customer_segmentVARCHAR(40)Customer market segment
carriers
ColumnTypeDescription
carrier_idPKINTUnique carrier identifier
carrier_nameVARCHAR(120)Carrier name
modeVARCHAR(30)Primary transportation mode
Tablesshipmentscustomerscarriers
Interviewer

Your question is Trade Lane Shipment Performance SQL. Start with the requirements and the three tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.