Example
$ echo 'id,txt,val
1,one,first number
42,forty-two,famous number
10000,ten thousand,big number' > /tmp/data.csv
sqlite3 imported.db '.import /tmp/data.csv data'
Create «loader» script:
$ echo '
.mode csv
.import /tmp/data.csv data' > /tmp/load.sql
Import CSV:
$ sqlite3 imported.db '.read /tmp/load.sql'
Table is created with text columns:
$ sqlite3 imported.db '.schema data'
CREATE TABLE data(
"id" TEXT,
"txt" TEXT,
"val" TEXT
);
In order to make sure that the datatypes are correct, it is suggested to create the table before it is loaded.