-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
75 additions
and
225 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
SELECT | ||
l.driver_name, | ||
e.event_name, | ||
s.session_type, | ||
t.track_name, | ||
COUNT(l.lap_id) AS total_laps, | ||
AVG(l.lap_time_in_seconds) AS avg_lap_time, | ||
MIN(l.lap_time_in_seconds) AS best_lap_time, | ||
AVG(l.sector_1_time_in_seconds) AS avg_sector1_time, | ||
AVG(l.sector_2_time_in_seconds) AS avg_sector2_time, | ||
AVG(l.sector_3_time_in_seconds) AS avg_sector3_time, | ||
AVG(l.finish_line_speed_trap_in_km) AS avg_finish_line_speed, | ||
COUNT(CASE WHEN l.is_personal_best THEN 1 END) AS personal_best_laps, | ||
AVG(w.air_temperature_in_celsius) AS avg_air_temp, | ||
AVG(w.track_temperature_in_celsius) AS avg_track_temp, | ||
SUM(CASE WHEN w.is_raining THEN 1 ELSE 0 END) * 100.0 / COUNT(*) AS rain_percentage | ||
FROM Laps l | ||
JOIN Sessions s ON l.session_id = s.session_id | ||
JOIN Tracks t ON s.track_id = t.track_id | ||
JOIN Event e ON s.event_id = e.event_id | ||
LEFT JOIN Weather w ON s.session_id = w.session_id | ||
AND l.lap_start_time_in_datetime BETWEEN w.datetime AND datetime(w.datetime, '+1 minutes') | ||
GROUP BY l.driver_name, e.event_id, s.session_id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
SELECT | ||
e.event_name, | ||
e.country, | ||
e.location, | ||
s.session_type, | ||
COUNT(DISTINCT l.driver_name) AS driver_count, | ||
AVG(l.lap_time_in_seconds) AS avg_lap_time, | ||
MIN(l.lap_time_in_seconds) AS best_lap_time, | ||
MAX(l.finish_line_speed_trap_in_km) AS max_finish_line_speed, | ||
AVG(w.air_temperature_in_celsius) AS avg_air_temp, | ||
AVG(w.track_temperature_in_celsius) AS avg_track_temp, | ||
SUM(CASE WHEN w.is_raining THEN 1 ELSE 0 END) * 100.0 / COUNT(*) AS rain_percentage | ||
FROM Event e | ||
JOIN Sessions s ON e.event_id = s.event_id | ||
JOIN Laps l ON s.session_id = l.session_id | ||
LEFT JOIN Weather w ON s.session_id = w.session_id | ||
AND l.lap_start_time_in_datetime BETWEEN w.datetime AND datetime(w.datetime, '+1 minutes') | ||
GROUP BY e.event_id, s.session_id; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
SELECT | ||
l.driver_name, | ||
l.lap_number, | ||
l.tyre_compound, | ||
AVG(l.tyre_life_in_laps) AS avg_tyre_life, | ||
AVG(l.lap_time_in_seconds) AS avg_lap_time, | ||
AVG(l.longest_strait_speed_trap_in_km) AS avg_top_speed, | ||
COUNT(CASE WHEN l.is_fresh_tyre THEN 1 END) AS fresh_tyre_laps, | ||
COUNT(CASE WHEN NOT l.is_fresh_tyre THEN 1 END) AS used_tyre_laps, | ||
AVG(w.track_temperature_in_celsius) AS avg_track_temp, | ||
AVG(w.air_temperature_in_celsius) AS avg_air_temp | ||
FROM Laps l | ||
INNER JOIN Weather w ON l.session_id = w.session_id | ||
AND l.lap_start_time_in_datetime BETWEEN w.datetime AND datetime(w.datetime, '+5 minutes') | ||
WHERE l.driver_name = :driver_name | ||
GROUP BY l.driver_name, l.lap_number, l.tyre_compound; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
SELECT | ||
e.event_name, | ||
s.session_type, | ||
t.track_name, | ||
AVG(w.air_temperature_in_celsius) AS avg_air_temp, | ||
AVG(w.track_temperature_in_celsius) AS avg_track_temp, | ||
AVG(w.relative_air_humidity_in_percentage) AS avg_humidity, | ||
AVG(w.wind_speed_in_meters_per_seconds) AS avg_wind_speed, | ||
SUM(CASE WHEN w.is_raining THEN 1 ELSE 0 END) * 100.0 / COUNT(*) AS rain_percentage, | ||
AVG(l.lap_time_in_seconds) AS avg_lap_time, | ||
MIN(l.lap_time_in_seconds) AS best_lap_time | ||
FROM Weather w | ||
JOIN Sessions s ON w.session_id = s.session_id | ||
JOIN Tracks t ON s.track_id = t.track_id | ||
JOIN Event e ON s.event_id = e.event_id | ||
JOIN Laps l ON s.session_id = l.session_id | ||
AND l.lap_start_time_in_datetime BETWEEN w.datetime AND datetime(w.datetime, '+1 minutes') | ||
GROUP BY e.event_id, s.session_id; |