Home >Database >Mysql Tutorial >How can I efficiently import tab-delimited data from a text file into a MySQL table using LOAD DATA INFILE?
Importing large text files into a MySQL database can be a common task in data processing workflows. To address this need, MySQL provides the LOAD DATA INFILE command, which allows users to efficiently load data from a tab-delimited file into a specified table.
You have a text file containing tab-delimited data that you want to import into a MySQL table named PerformanceReport in the database Xml_Date. You have created the table with the appropriate destination fields.
The LOAD DATA INFILE command provides a convenient way to import data from a text file into a MySQL table. The command syntax is as follows:
LOAD DATA INFILE 'file_path' INTO TABLE table_name;
In your specific case, the following command should import the data from the text_file.txt file into the PerformanceReport table:
LOAD DATA INFILE '/path/to/text_file.txt' INTO TABLE PerformanceReport;
By default, LOAD DATA INFILE assumes that the text file is tab-delimited and each row occupies a single line. This matches the format of your input data, so the import should proceed smoothly.
The above is the detailed content of How can I efficiently import tab-delimited data from a text file into a MySQL table using LOAD DATA INFILE?. For more information, please follow other related articles on the PHP Chinese website!