3

From the www.sqlite.org, I can import data from the csv file as the following.

sqlite> .mode csv
sqlite> .import data.csv name_table

If the table does not previously exist, the table is automatically created and the content of the first row of the input CSV file is used to determine the name of all the columns in the table.

But the data type for each column is always TEXT. I want to make some column as INTEGER. How can I set the data type in the csv file.

data.csv
NAME,IMAGE,GENERAL,NUMBER
AAA,img0001.png,"This is Yu's favorite. AAA is not a girl.",15
BBB,img0002.png,This is Yu's favorite,20
CCC,img0003.png,This is Yu's favorite,30

sqlite> .schema
CREATE TABLE name_table(
  "NAME" TEXT,
  "IMAGE" TEXT,
  "GENERAL" TEXT,
  "NUMBER" TEXT
);
2

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.