Skip to content

LOAD

LOAD DATA INFILE '/path/to/your/file.txt'
INTO TABLE your_table
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n';

The output is not typically displayed in a text format, as the output of a LOAD DATA INFILE statement is the number of rows inserted, which is displayed by MySQL application. Therefore, for illustrative purposes, the output can be represented as follows:

Query OK, 3 rows affected (0.01 sec)
Records: 3 Deleted: 0 Skipped: 0 Warnings: 0

In the example, the LOAD DATA INFILE command is used to import data from a text file into a table in the MySQL database. The path to the text file would replace '/path/to/your/file.txt', and the name of the table into which the data is to be imported would replace your_table. The FIELDS TERMINATED BY ',' line specifies that fields in the text file are separated by commas and the LINES TERMINATED BY '\n' line specifies that new lines denote new records.