I am importing some data of 20000 rows from a CSV file into Mysql.
Columns in the CSV are in a different order than MySQL table's columns. How to automatically assign columns corresponding to Mysql table columns?
When I execute
LOAD DATA INFILE'abc.csv' INTO TABLE abc
this query adds all data to the first column.
Please suggest auto syntax for importing data to Mysql.
You can use LOAD DATA INFILE command to import csv file into table.
Check this link MySQL - LOAD DATA INFILE.
You can try to insert like this :
You can load data from a csv or text file. If you have a text file with records from a table, you can load those records within the table. For example if you have a text file, where each row is a record with the values for each column, you can load the records this way.
table.sql
table.txt
--example on windows
Syntax:
See this Example: