我试图导入一个数据集,其中包含一些用双引号括起来的文本字段" sometext"但是当我尝试加载文件时,它仍会显示双引号。
这是sql
LOAD DATA LOCAL INFILE '/Users/Carlos/Desktop/smallData.txt'
into table acars
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'
IGNORE 1 ROWS
(@Date, @Time, flight, n_number, blk_id, msg_label, text_label, msg_text)
SET Date_Time = STR_TO_DATE(CONCAT(@Date, ' ', @Time), '%d/%m/%Y %H:%i');
使用这个小数据样本:
date_dd_mm_yyyy; time_est; flight; n_number; blk_id; msg_label; text_label; msg_text
01/03/2014; 00:02; XA0001; ..VQBZZ; 3; 15; ""; " (2N26451W 81508---100354---(Z"
01/03/2014; 00:04; CO1588; .N71411; 7; H1; "msg to/from terminal"; " #DFB96 0 877"
01/03/2014; 00:12; XA0001; ..VQBZZ; 4; 15; ""; " (2N27038W 82483--- 94423---(Z"
问题是我为所有行恢复了这种格式:
| 2014-03-01 00:02:00 | XA0001 | ..VQBZZ | 3 | 15 | "" | " (2N26451W 81508---100354---(Z" |
基本上它只是没有OPTIONALLY ENCLOSED BY '"'
部分