应伯尼的要求,我试图将其浓缩为一个更简单的例子:
我有一个 CSV 文件,其中包含一个月份,其中星期几是列标题:
Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday
1,2,3,4,5,6,7
8,9,10,11,12,13,14
15,16,17,18,19,20,21
22,23,24,25,26,27,28
在命令行中,我创建了一个 SQLite 表,天数:
sqlite> CREATE TABLE days(
...> Monday int,
...> Tuesday int,
...> Wednesday int,
...> Thursday int,
...> Friday int,
...> Saturday int,
...> Sunday int
...> );
尝试从 csv 导入数据时,我得到以下信息:
sqlite> .import example.csv days
Error: example.csv line 1: expected 7 columns of data but found 1
如何将此 csv 文件导入数据库,以便识别每个新行?谢谢!