I am stuck in a situation where I have to read data from 3 separate large CSV files and store it in MySQL database.
csv file columns:
total_rev,monthly_rev,day_rev
Database table's columns:
total_rev, monthly_rev, day_rev, from
I am able to insert data in my table by using following query:
LOAD DATA LOCAL INFILE '/home/datauser/Desktop/working/revenue_2016_10_06.csv'
INTO TABLE revenue_table
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(total_rev,monthly_rev,day_rev);
But I am stuck in a situation where I want to add hard coded parameter in the "Load Data Local" query to add from's value depending upon the file.
so at the end my table will contain records like:
total_rev, monthly_rev, day_rev, from
11, 222, 333, file1
22, 32, 343, file1
11, 22, 333, file1
11, 22, 33, file22
11, 22, 33, file22
How can I specify this file1, file22 value's in above query ?