SQL

SQL 라이브 코테 뽀개기 Day2: Unfinished Parts

sawo11 2025. 3. 6. 17:57

Tesla is investigating production bottlenecks and they need your help to extract the relevant data. Write a query to determine which parts have begun the assembly process but are not yet finished.

Assumptions:

  • parts_assembly table contains all parts currently in production, each at varying stages of the assembly process.
  • An unfinished part is one that lacks a finish_date.

This question is straightforward, so let's approach it with simplicity in both thinking and solution.

Effective April 11th 2023, the problem statement and assumptions were updated to enhance clarity.

parts_assembly Table

Column NameType
part string
finish_date datetime
assembly_step integer

parts_assembly Example Input

part finish_date assembly_step
battery 01/22/2022 00:00:00 1
battery 02/22/2022 00:00:00 2
battery 03/22/2022 00:00:00 3
bumper 01/22/2022 00:00:00 1
bumper 02/22/2022 00:00:00 2
bumper   3
bumper   4

Example Output

part assembly_step
bumper 3
bumper 4
SELECT part, 
  assembly_step
FROM parts_assembly
WHERE finish_date IS NULL;