logo

Back to questions

Unfinished Parts [Tesla SQL Interview Question]

Easy

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

Assumptions

  • Table contains all parts in production.
  • A part with no is an unfinished part.

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

part
bumper

Explanation

The only item in the output is "bumper" because step 3 didn't have a finish date.

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

PostgreSQL 14