MySQL 导出的时候, OPTIONALLY 是个什么作用?
PHPz
PHPz 2017-04-17 14:27:31
0
1
633

我学MySQL导入导出的时候,在菜鸟教程俩例子:

第一个:

SELECT * FROM c200401 INTO OUTFILE 'D:/csv.txt'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n';

第二个:

SELECT * FROM c200401 INTO OUTFILE 'D:/result2.txt'
FIELDS TERMINATED BY ','
OPTIONALLY
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n';

第二个比第一个多了个 OPTIONALLY ,我试了试, 第一组数据少了个一对"",
我想问问,OPTIONALLY有什么讲究?

PHPz
PHPz

学习是最好的投资!

reply all(1)
伊谢尔伦

[OPTIONALLY] ENCLOSED indicates what characters are used to include the field. If OPTIONALLY is used, only CHAR and VERCHAR are included. ESCAPED indicates what characters are used as escape characters when escaping is required. LINES TERMINATED indicates what characters are used to separate each row of records.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template