我在尝试将整个csv文件导入到sqlite数据库时遇到问题。这些都是我的终端命令:无法从csv文件导入多个行到sqlite数据库
sqlite3 DB.sql
create table table1 (id integer primary key, question VARCHAR(500), Aanswer VARCHAR(255), Banswer VARCHAR(255), Canswer VARCHAR(255), Danswer VARCHAR(255));
.mode csv
.import db.csv table1
select * from table1
和输出:
7,"Who's head did Courtney Cox say was on her body in Scream 2?","Heather Graham",Oprah,"*Jennifer Aniston","Demi Moore"
你会发现,它只是把周围的几个领域,这似乎是随机的引号......我不不知道这是为什么它不会继续导入下一行。
谢谢!
编辑:
这里是我的csv文件的前几行:
1,What movie follows Cher and Dionne named after great singers of the past that now do infomercials?,10 Things I Hate About You,Cant Hardly Wait,*Clueless,Freeway
2,What 90s movie did critic Janet Maslin describe as : A gale-force movie with the energy to blow audiences right out of the theater?,Avalanche,Aftershocks,Armageddon,*Twister
3,What actress declined Neve Campbell's role in Scream?,*Drew Barrymore,Carla Hatley,Courteney Cox,Rose McGowan
如果我把引号中的自己,它吐出来的东西是这样的:
"""What was the name of Milla Jovovich's character in the Fifth Element?""","""Billy""","""Fog""","""Mugger""","""*Leeloo"""
我的猜测是你的CSV文件有问题。请发布前10行。 – ravenspoint 2011-06-02 18:43:38