gpt4 book ai didi

mysql - 将数据加载到 mysql 忽略第一行

转载 作者:行者123 更新时间:2023-11-29 05:40:38 29 4
gpt4 key购买 nike

我正在尝试将文本文件中的一些数据加载到 mysql 中。我想忽略第一行。

从 mysql 5.5 手册中,有一个“忽略 1 行”选项。

我试过使用此查询无济于事:

LOAD DATA LOCAL INFILE 'iso-languagecodes.txt' INTO TABLE iso_languagecodes (iso_639_3, iso_639_2, iso_639_1, language_name) IGNORE 1 LINES; 

谁能指出哪里不对?

这是我收到的错误

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near ' IGNO
RE 1 LINES' at line 1

以下 2 个查询将起作用:

LOAD DATA LOCAL INFILE 'iso-languagecodes.txt' INTO TABLE iso_languagecodes (iso_639_3, iso_639_2, iso_639_1, language_name);

LOAD DATA LOCAL INFILE 'iso-languagecodes.txt' INTO TABLE iso_languagecodes IGNORE 1 LINES;

但是,我需要能够指定列并忽略第一行。

最佳答案

对于那些感兴趣的人,这是最终的解决方案:

LOAD DATA LOCAL INFILE 'iso-languagecodes.txt' INTO TABLE iso_languagecodes IGNORE 1 LINES (iso_639_3, iso_639_2, iso_639_1, language_name);

关于mysql - 将数据加载到 mysql 忽略第一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7020750/

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