当前位置:Gxlcms > 数据库问题 > mysql load data infile

mysql load data infile

时间:2021-07-01 10:21:17 帮助过:30人阅读

| 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);

 

mysql load data infile

标签:文件   cal   文字   priority   closed   current   tin   名称   nbsp   

人气教程排行