Question: I need to come up with a query for average accident severity and the number of accidents for vehicles of type motorcycle. Here is the

I need to come up with a query for average accident severity and the number of accidents for vehicles of type motorcycle. Here is the background of the project...

Create a MySQL schema named accidents.

Within the accidents schema, create a table named accidents_2016 with the following columns:

accident_index as a varchar(13),

accident_severity as an int

Within the accidents schema, create a table named vehicles_2016 with the following columns:

accident_index as a varchar(13),

vehicle_type as a varchar(10)

Within the accidents schema, create a table named vehicle_type with the following columns:

vcode int,

vtype as a varchar(100)

Next, you will load the data for the three tables.

Load the accidents data. Note that @dummy is a placeholder for a column in the .csv file that you want to ignore during the load.

load data local infile '\\data\\Accidents_2016.csv' into table accidents_2016 fields terminated by ',' enclosed by '"' lines terminated by ' ' ignore 1 lines (@col1, @dummy, @dummy, @dummy, @dummy, @dummy, @col2 ,@dummy, @dummy, @dummy, @dummy, @dummy ,@dummy, @dummy, @dummy, @dummy, @dummy ,@dummy, @dummy, @dummy, @dummy, @dummy ,@dummy, @dummy, @dummy, @dummy, @dummy ,@dummy, @dummy, @dummy, @dummy, @dummy ) set accident_index=@col1,accident_severity=@col2;

Load the vehicle data.

load data local infile '\\data\\Vehicles_2016.csv' into table vehicles_2016 fields terminated by ',' enclosed by '"' lines terminated by ' ' ignore 1 lines (@col1, @dummy, @dummy, @col2 ,@dummy, @dummy, @dummy, @dummy, @dummy ,@dummy, @dummy, @dummy, @dummy, @dummy ,@dummy, @dummy, @dummy, @dummy, @dummy ,@dummy, @dummy, @dummy, @dummy, @dummy ) set accident_index=@col1,vehicle_type=@col2;

Load the vehicle type data.

load data local infile '\\data\\vehicle_type.csv' into table vehicle_type fields terminated by ',' enclosed by '"' lines terminated by ' ' ignore 1 lines

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!