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
SQL Top Three Production Lines
00:00
5 left

SQL Top Three Production Lines

MediumSQL · PostgreSQL

Problem

Write a SQL query to find the top three performing production lines by yield percentage over the last quarter at MilliporeSigma.

Use the production_lines and production_runs tables. Yield percentage is total good units divided by total produced units, multiplied by 100. The last quarter means the previous calendar quarter relative to the query execution date.

Output

  1. One row per qualifying production line with line_id, line_name, and yield_percentage.
  2. Include only production lines with production activity during the last quarter.
  3. Sort by yield_percentage descending, then line_id ascending to break ties.

Schema

production_lines
ColumnTypeDescription
line_idPKINTUnique production line identifier
line_nameVARCHAR(100)Production line name
site_nameVARCHAR(100)MilliporeSigma manufacturing site
product_familyVARCHAR(100)Primary product family manufactured by the line
production_runs
ColumnTypeDescription
run_idPKINTUnique production run identifier
line_idINTProduction line associated with the run
production_dateDATEDate on which the run was completed
produced_unitsINTTotal units produced during the run
good_unitsINTUnits meeting quality requirements
Tablesproduction_linesproduction_runs
Interviewer

Your question is SQL Top Three Production Lines. Start with the requirements and the two 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.