AnalystPath

Charging Session Outliers (Z-Score)

SQLHardSenior levelTesla~15 min

Problem

**[Asked at Tesla]**

A charging session is an outlier if its `kwh_delivered` deviates from the
station's average by more than 1.5 standard deviations.

Return outlier sessions: `id`, `station`, `kwh_delivered`, `z_score`
(absolute value, rounded to 2 dp), ordered by z_score descending.

Tables

Example rows — the live problem includes the full dataset.

charging_sessions
idstationkwh_delivered

Expected output

Your answer should return 2 rows with the columns id, station, kwh_delivered, z_score.

Starter code (SQL)

SELECT *
FROM charging_sessions;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions