MySQL 语句:数据处理语句(DML):LOAD DATA 语句
跳到导航
跳到搜索
关于
LOAD DATA
[LOW_PRIORITY | CONCURRENT] [LOCAL]
INFILE 'file_name'
[REPLACE | IGNORE]
INTO TABLE tbl_name
[PARTITION (partition_name [, partition_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 | ROWS}]
[(col_name_or_user_var
[, col_name_or_user_var] ...)]
[SET col_name={expr | DEFAULT}
[, col_name={expr | DEFAULT}] ...]
LOAD DATA 语句以非常高的速度将文本文件中的行读取到 table 中。 LOAD DATA 是“SELECT ... INTO OUTFILE”的补充。
- 要将数据从 table 写入文件,请使用“SELECT ... INTO OUTFILE”。
- 要将文件读回到 table 中,请使用“LOAD DATA”。
- 两条语句的 FIELDS 和 LINES 子句的语法相同。