I need to do an assignment that load date from csv, but the data attribute in the csv ins not fit with the SQL table. The SQL table schema like
BUS(id, Duration, totalcustomer)
But the csv file title like
id=1, Start time =00:00:00, end time=00:01:11, male customer=20, female customer=20
The output the Table will like id=1, drration=00:01:11, total customer =40
So, in the SQL table,Duration= end time -start time
, and totalcustomer=male customer + female customer
.
I try SQL expressions like below but not work
LOAD DATA LOCAL INFILE 'BUS.csv'
INTO TABLE BUS
FIELDS ENCLOSED BY '\"'TERMINATED BY ','
LINES TERMINATED BY '\n'
(@id, @Duration, @totalcustomer)
SET 'end time' - 'start time' = @Duration,
'male customer'+ 'female customer' = @totalcustomer
So, do I need to make a new table to load the csv data and do the calculation in MySQL?