mysql load data infile
Posted 雨落知音
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql load data infile相关的知识,希望对你有一定的参考价值。
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE ‘file_name.txt‘ [REPLACE | IGNORE] INTO TABLE tbl_name [FIELDS [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语句用于高速地从一个文本文件中读取行,并装入一个表中。文件名称必须为一个文字字符串。
由character_set_database系统变量指示的字符集被用于解释文件中的信息。SET NAMES和character_set_client的设置不会影响对输入的解释。 典型的示例 LOAD DATA LOCAL INFILE ‘data.txt‘ INTO TABLE tbl_name FIELDS TERMINATED BY ‘,‘ OPTIONALLY ENCLOSED BY ‘"‘ LINES TERMINATED BY ‘\n‘ 如果您只想载入一个表的部分列,则应指定一个列清单: LOAD DATA LOCAL INFILE ‘persondata.txt‘ INTO TABLE persondata (col1,col2);