Baselight
Loading...Loading chart...
1SELECT 
2  CASE 
3    WHEN LOWER("type") LIKE '%boeing%' THEN 'Boeing'
4    WHEN LOWER("type") LIKE '%airbus%' THEN 'Airbus'
5    WHEN LOWER("type") LIKE '%lockheed%' THEN 'Lockheed'
6    WHEN LOWER("type") LIKE '%fairchild%' THEN 'Fairchild'
7    WHEN LOWER("type") LIKE '%douglas%' THEN 'Douglas'
8    WHEN LOWER("type") LIKE '%mcdonnel%' THEN 'McDonnel'
9    WHEN LOWER("type") LIKE '%canadair%' THEN 'Canadair'
10    ELSE 'Other'
11  END as "Manufacturer",
12  COUNT(*) as "Number of Crashes",
13  AVG("aboard") as "Average aboard",
14  AVG("ground") as "Average killed in ground",
15  AVG("fatalities") as "Average Number of Fatalities",
16  AVG("survivalrate") as "Survival Rate"
17FROM 
18  @kaggle.juancarlosventosa_large_passenger_plane_crashes_19332009.large_passenger_plane_crashes_1933_to_2009
19GROUP BY 
20  CASE 
21    WHEN LOWER("type") LIKE '%boeing%' THEN 'Boeing'
22    WHEN LOWER("type") LIKE '%airbus%' THEN 'Airbus'
23    WHEN LOWER("type") LIKE '%lockheed%' THEN 'Lockheed'
24    WHEN LOWER("type") LIKE '%fairchild%' THEN 'Fairchild'
25    WHEN LOWER("type") LIKE '%douglas%' THEN 'Douglas'
26    WHEN LOWER("type") LIKE '%mcdonnel%' THEN 'McDonnel'
27    WHEN LOWER("type") LIKE '%canadair%' THEN 'Canadair'
28    ELSE 'Other'
29  END
30ORDER BY 
31  "Number of Crashes" DESC;
32
ManufacturerNumber of CrashesAverage aboardAverage killed in groundAverage Number of FatalitiesSurvival Rate
Boeing150152.6933333333333318.95333333333333399.813333333333330.30162190128000016
Other146108.89726027397261.157534246575342489.575342465753420.15560274076712327
Douglas90144.433333333333341.122222222222222283.333333333333330.35762248045555556
Lockheed35131.742857142857130.742857142857142994.742857142857150.18324848534285715
Airbus30189.533333333333330.966666666666666796.633333333333340.4655128034333333
McDonnel21210590.466993171
Fairchild2820820
Canadair1840720.142857143

Share link

Anyone who has the link will be able to view this.