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
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess 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
Get started
Top Server Components by Failures
00:00
5 left

Top Server Components by Failures

HardSQL · PostgreSQL

Problem

Supermicro's operations team wants to identify the best-performing server components for each month. Write a PostgreSQL query that calculates monthly failure rates while accounting for shipment volume, then returns the top three components per month.

Requirements

  1. Aggregate shipped units and failed units by component and calendar month.
  2. Include components with shipments but no recorded failures, treating their failed-unit count as zero.
  3. Exclude months where total shipment volume is zero and rank components by the lowest failure rate, then highest shipment volume.
  4. Return the top three ranked components for January and February 2025.

Output details

  • Return columns in this order: month, component_name, shipment_volume, failed_units, failure_rate_pct, performance_rank.
  • Format month as YYYY-MM.
  • Calculate failure_rate_pct as a percentage rounded to two decimal places.
  • Break equal failure-rate and shipment-volume ties by component_name ascending.
  • Include shipment and failure dates from 2025-01-01 inclusive through 2025-03-01 exclusive.
  • Sort results by month ascending, then performance_rank ascending.

Schema

components
ColumnTypeDescription
component_idPKINTUnique component identifier
component_nameVARCHAR(100)Supermicro component name
component_typeVARCHAR(50)Component category
statusVARCHAR(20)Component lifecycle status
shipments
ColumnTypeDescription
shipment_idPKINTUnique shipment record identifier
component_idINTComponent included in the shipment
shipment_dateDATEDate units were shipped
units_shippedINTNumber of units shipped
failures
ColumnTypeDescription
failure_idPKINTUnique failure record identifier
component_idINTComponent associated with the failure
failure_dateDATEDate the failure was reported
units_failedINTNumber of failed units in the record
Tablescomponentsshipmentsfailures
Interviewer

Your question is Top Server Components by Failures. 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.