If you are a MySQL user, its most likely that you would have come across a need for importing the data in the Excel or CSV files directly to you MySQL tables. The ‘LOAD DATA LOCAL INFILE’ command supported by MySQL can help you to achieve your purpose. Below is the syntax for using this command,
LOAD DATA LOCAL INFILE ‘C:\\test\\userData.csv’ INTO TABLE User FIELDS TERMINATED BY ‘,’ (name,email,address)
In the above command, I am inserting the data into three of the columns in the ‘User’ table directly from the ‘userData.csv’ file. If you have the data in an Excel file, you need to convert it to a CSV file before using this command. Also, make sure you don’t have any column headers in the file before using this command.