MySQL LOAD DATA INFILE statement allows to import data into table. This statement facilitates to import data of several formats like csv data, Microsoft Excel, text file and other delimited text files with wide array of options that make this feature so powerful. Suppose you want to import a text file titled authorlist.txt, which contains the following information:
'1','Kenneth James','kj@example.com','CA'
'2','Ashley Lawis','al@example.com','DC'
'3','Arnold Alister','aa@example.com','OH'
The target table, namely authors, consists of three fields, and they are in the same order (author_id, author_email, author_state) as the information found in authorlist.txt:
LOAD DATA LOCAL INFILE authorlist.txt' INTO TABLE authors
FIELDS TERMINATED BY ',' ENCLOSED BY '\''
ESCAPED BY '\\' LINES TERMINATED BY '\n';