Back to questions

Unfinished Parts Tesla SQL Interview Question

Unfinished Parts

Tesla SQL Interview Question

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:

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

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.

Table

Column NameType
partstring
finish_datedatetime
assembly_stepinteger

Example Input

partfinish_dateassembly_step
battery01/22/2022 00:00:001
battery02/22/2022 00:00:002
battery03/22/2022 00:00:003
bumper01/22/2022 00:00:001
bumper02/22/2022 00:00:002
bumper3
bumper4

Example Output

partassembly_step
bumper3
bumper4

Explanation

The bumpers in step 3 and 4 are the only item that remains unfinished as it lacks a recorded finish date.

The dataset you are querying against may have different input & output - this is just an example!

Input

(PostgreSQL)

Output