Search ⌘K
Tesla
Tesla

Interview Core Track · Easy · 15 min

11. Tesla Fleet Efficiency Analysis

You are a data analyst at Tesla and the company is focused on improving the efficiency of its vehicle fleet. Based on service data, the Company would like to...

Interview Core Track
Easy
15 min
joins
aggregation

Company labels are directional practice context, not official interview guidance.

Timer 00:00
Back to practice

Objective

Practice joins through a Tesla-tagged business scenario.

Approach

Use this track to improve speed, edge-case handling, and accuracy under timed conditions.

Company context

Company labels are directional practice context, not official interview guidance.

Prereq: query basics
Prereq: filtering

You are a data analyst at Tesla and the company is focused on improving the efficiency of its vehicle fleet. Based on service data, the Company would like to analyze the average distance driven and power consumed by each model of its vehicles across different years. Tesla has two tables, vehicles and service_data. The vehicles table has four columns: vehicle_id, model_name, manufacture_year and owner_id, where vehicle_id is a unique identifier for each vehicle. vehicles **Example Input:** vehicle_id model_name manufacture_year owner_id -------- 001 Model S 2018 1001 002 Model 3 2019 1002 003 Model X 2020 1003 004 Model S 2019 1004 005 Model 3 2018 1005 The service_data table has four columns: record_id, vehicle_id, distance_driven (in miles), and power_consumed (in kilowatt hour), where record_id is a unique identifier for each service record. service_data **Example Input:** record_id vehicle_id distance_driven power_consumed -------- a001 001 1200 400 a002 002 1000 250 a003 003 1500 500 a004 001 1300 450 a005 004 1100 420 **Write a query that produces a report summarizing the average distance driven and average power consumed by each model manufactured in each year.** **Answer:** SELECT model_name, manufacture_year, AVG(distance_driven) AS avg_distance, AVG(power_consumed) AS avg_power FROM vehicles v JOIN service_data s USING(vehicle_id) GROUP BY 1, 2 ORDER BY 1, 2 ---

vehicles
vehicle_id TEXT PRIMARY KEY
model_name TEXT
manufacture_year INTEGER
owner_id INTEGER
service_data
record_id TEXT PRIMARY KEY
vehicle_id TEXT
distance_driven NUMERIC(10
2
Editor
SQL workspace

Run queries against the protected question data, then submit once the result shape looks right.

Sign in to run SQL

Create a free account or sign in before running queries against protected question data.