
Mekki MOURADI
Data Analyst
Rabat, Maroc
À Propos
Data Analyst Junior avec une solide expérience en marketing numérique et des compétences approfondies dans l’utilisation de Microsoft Excel, SQL, Tableau Software et Python.
Vehicle Accidents Analysis with SQL


Compétences & Outils
Description du projet
Apprendre à combiner plusieurs outils d’analyse et de visualisation pour répondre aux questions commerciales :
- Utiliser SQL pour manipuler et analyser les données
- Utiliser Tableau pour visualiser les résultats et les rendre plus accessibles
Objectifs de l'analyse
Utiliser SQL et Tableau pour manipuler, analyser et visualiser les données
- Combien d'accidents se sont produits en zones urbaines par rapport aux zones rurales ?
SELECT COUNT(accidentindex) AS accidents, area
FROM accident
GROUP BY area;
accidents | area |
---|---|
58533 | Urban |
21999 | Rural |
- Quel jour de la semaine a le plus grand nombre d'accidents ?
SELECT day, COUNT(accidentindex) AS number_accidents
FROM accident
GROUP BY day
ORDER BY number_accidents DESC
LIMIT 1;
day | number_accidents |
---|---|
Friday | 12937 |
- Quel est l'âge moyen des véhicules impliqués dans des accidents de la route en fonction de leur type?
SELECT vehicletype, ROUND(AVG(agevehicle),2) AS average
FROM vehicle
GROUP BY vehicletype
HAVING ROUND(AVG(agevehicle),2) IS NOT NULL
ORDER BY average DESC;

vehicletype | average |
---|---|
Motorcycle over 500cc | 10.46 |
Motorcycle over 125cc and up to 500cc | 10.38 |
Motorcycle - unknown cc | 8.58 |
Car | 8.27 |
Agricultural vehicle | 7.90 |
Other vehicle | 7.82 |
Minibus (8 - 16 passenger seats) | 7.75 |
Bus or coach (17 or more pass seats) | 7.14 |
Goods vehicle - unknown weight | 6.63 |
Goods over 3.5t. and under 7.5t | 6.56 |
Motorcycle 50cc and under | 6.50 |
Taxi/Private hire car | 6.35 |
Van / Goods 3.5 tonnes mgw or under | 6.27 |
Motorcycle 125cc and under | 6.09 |
Goods 7.5 tonnes mgw and over | 5.29 |
Data missing or out of range | 4.00 |
Mobility scooter | 2.50 |
- Peut on identifier une quelconque corrélation entre le nombre d'accidents et l'âge du véhicule ?
- Extraction des données nécessaires
SELECT vehicletype, COUNT(accidentindex) AS number_accidents, ROUND(AVG(agevehicle),2) AS vehicle_age
FROM vehicle
GROUP BY vehicletype
ORDER BY number_accidents DESC;

vehicletype | number_accidents | vehicle_age |
---|---|---|
Car | 182954 | 8.27 |
Pedal cycle | 19440 | NULL |
Van / Goods 3.5 tonnes mgw or under | 13876 | 6.27 |
Motorcycle 125cc and under | 9234 | 6.09 |
Motorcycle over 500cc | 7054 | 10.46 |
Taxi/Private hire car | 5420 | 6.35 |
Bus or coach (17 or more pass seats) | 5381 | 7.14 |
Goods 7.5 tonnes mgw and over | 4762 | 5.29 |
Motorcycle 50cc and under | 2237 | 6.50 |
Motorcycle over 125cc and up to 500cc | 2187 | 10.38 |
Goods over 3.5t. and under 7.5t | 1708 | 6.56 |
Other vehicle | 1286 | 7.82 |
Goods vehicle - unknown weight | 615 | 6.63 |
Agricultural vehicle | 504 | 7.90 |
Minibus (8 - 16 passenger seats) | 498 | 7.75 |
Motorcycle - unknown cc | 275 | 8.58 |
Mobility scooter | 222 | 2.50 |
Ridden horse | 107 | NULL |
Data missing or out of range | 58 | 4.00 |
Tram | 18 | NULL |
Electric motorcycle | 9 | NULL |
- Visualisation des résultats
D’après le scatterplot, on ne peut conclure aucune corrélation entre le nombre d’accidents et l’âge moyen du véhicule
- Y a-t-il des conditions météorologiques spécifiques qui contribuent aux accidents graves ?
SELECT weatherconditions, severity, COUNT(accidentindex) AS accidents
FROM accident
WHERE severity='Fatal'
GROUP BY weatherconditions, severity
ORDER BY accidents DESC;

weatherconditions | severity | accidents |
---|---|---|
Fine no high winds | Fatal | 668 |
Raining no high winds | Fatal | 84 |
Fine + high winds | Fatal | 18 |
Unknown | Fatal | 17 |
Raining + high winds | Fatal | 17 |
Other | Fatal | 7 |
Fog or mist | Fatal | 5 |
Snowing no high winds | Fatal | 1 |
D’après la treemap, on ne peut considérer de conditions météorologiques spécifiques qui contribueraient aux accidents graves.
- Les accidents impliquent-ils souvent des impacts du côté gauche des véhicules ?
SELECT lefthand, COUNT(accidentindex) AS number_accidents
FROM vehicle
GROUP BY lefthand
lefthand | number_accidents |
---|---|
Data missing or out of range | 1019 |
No | 255480 |
Yes | 1346 |
- Y a-t-il une quelconque relation entre les motifs de déplacements et la gravité des accidents ?
SELECT v.journeypurpose, a.severity, COUNT(v.accidentindex) AS accidents
FROM vehicle v
JOIN accident a
ON a.accidentindex=v.accidentindex
WHERE journeypurpose NOT IN ('Data missing or out of range', 'Other')
GROUP BY v.journeypurpose, a.severity
ORDER BY journeypurpose,
CASE
WHEN severity='Fatal' THEN 1
WHEN severity='Serious' THEN 2
ELSE 3
END;

journeypurpose | severity | accidents |
---|---|---|
Commuting to/from work | Fatal | 112 |
Commuting to/from work | Serious | 1833 |
Commuting to/from work | Slight | 25021 |
Journey as part of work | Fatal | 310 |
Journey as part of work | Serious | 2632 |
Journey as part of work | Slight | 36843 |
Not known | Fatal | 1014 |
Not known | Serious | 13108 |
Not known | Slight | 171924 |
Pupil riding to/from school | Fatal | 2 |
Pupil riding to/from school | Serious | 38 |
Pupil riding to/from school | Slight | 777 |
Taking pupil to/from school | Fatal | 5 |
Taking pupil to/from school | Serious | 120 |
Taking pupil to/from school | Slight | 2509 |
- Calculer l'âge moyen des véhicules impliqués dans des accidents, en tenant compte de la lumière du jour et du point d'impact.
SELECT a.lightconditions, v.pointimpact, ROUND(AVG(v.agevehicle),2) AS avg_vehicle_age
FROM accident a
JOIN vehicle v
ON a.accidentindex=v.accidentindex
GROUP BY a.lightconditions, v.pointimpact

lightconditions | pointimpact | avg_vehicle_age |
---|---|---|
Darkness | Back | 7.73 |
Darkness | Did not impact | 6.80 |
Darkness | Front | 8.22 |
Darkness | Nearside | 7.75 |
Darkness | Offside | 7.83 |
Daylight | Back | 7.57 |
Daylight | Data missing or out of range | 8.30 |
Daylight | Did not impact | 7.51 |
Daylight | Front | 8.31 |
Daylight | Nearside | 7.91 |
Daylight | Offside | 7.92 |