Reputation: 63
I've a file named rates.txt
which has the following rows:
0.5,28.55,51.3
1,43.74,68.38
1.5,61.62,85.5
2,79.56,102.56
I've a MSQL table named rates
with columns A,B,C
.
How would I be able to import all the rows in the text file into the mysql table.
Thanks,
Upvotes: 0
Views: 78
Reputation: 6132
It should be as simple as...
LOAD DATA INFILE '/tmp/mydata.txt' INTO TABLE PerformanceReport;
By default LOAD DATA INFILE
uses tab delimited, one row per line, so should take it in just fine
sample code:
LOAD DATA LOCAL INFILE 'abc.txt' INTO TABLE abc
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(col1, col2, col3, col4, col5...)
refer this link : https://stackoverflow.com/a/22801922/3242978
Upvotes: 0