gpt4 book ai didi

CSV 文件到 MySQL 数据库

转载 作者:行者123 更新时间:2023-11-29 02:04:17 25 4
gpt4 key购买 nike

我有一个 CSV 文件,格式如下:

"id","code","date","address","complete_url"

来自 CSV 的示例数据:

"144003286","ICXT","20100104","NJ","http://www.orhancanceylan.com"
"144003286","SEED","20100104","NY","http://www.erbileren.com"
"144003286","ANX","20100104","CA","http://www.foursquareme.com"
"144003286","AIG","20100104","NJ","http://www.orhancanceylan.com"

我想将所有数据加载到 MySQL 中。我尝试了以下命令:

LOAD DATA LOCAL INFILE 'C:\\Users\\pb\\Documents/data.csv' 
INTO TABLE new_table
FIELDS TERMINATED BY '","' ENCLOSED BY '"'
LINES TERMINATED BY '\n'

我收到以下错误:

1265 Data truncated for column 'id' at row 1
1261 Row 1 doesn't contain data for all columns
1261 Row 1 doesn't contain data for all columns
1261 Row 1 doesn't contain data for all columns
1261 Row 1 doesn't contain data for all columns
Records: 1 Deleted: 0 Skipped: 0 Warnings: 5 3.620 sec

我的代码或 CSV 有什么问题?

最佳答案

FIELDS TERMINATED BY'","' 更改为 ','

关于CSV 文件到 MySQL 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9237492/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com