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;
'SQL' 카테고리의 다른 글
SQL 라이브 코테 뽀개기 Day4: Average Post Hiatus (Part 1) (0) | 2025.03.07 |
---|---|
SQL 라이브 코테 뽀개기 Day3: Laptop vs. Mobile Viewership (0) | 2025.03.06 |
SQL 라이브 코테 뽀개기 Day2: Page With No Likes (0) | 2025.03.06 |
라이브 코딩테스트 뽀개기 Day1: Data Science Skills (0) | 2025.03.06 |
라이브 코딩테스트 뽀개기 Day1: Histogram of Tweets (0) | 2025.03.06 |