Load data infile digunakan untuk memasukkan data ke tabel di dalam database dari sebuah file dari suatu folder.
Format Umum :
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name' [REPLACE | IGNORE] INTO TABLE tbl_name [CHARACTER SET charset_name] [{FIELDS | COLUMNS} [TERMINATED BY 'string'] [[OPTIONALLY] ENCLOSED BY 'char'] [ESCAPED BY 'char'] ] [LINES [STARTING BY 'string'] [TERMINATED BY 'string'] ] [IGNORE number LINES] [(col_name_or_user_var,...)] [SET col_name = expr,...]
LOAD DATA INFILE 'C:/testsql/databuku.txt' INTO TABLE t_buku;
LOAD DATA INFILE 'C:/testsql/databuku.txt' INTO TABLE t_buku FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n';
LOAD DATA INFILE 'C:/testsql/databuku.txt' INTO TABLE t_buku FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n' (CODE,judul,tahun_terbit);