Import csv file into sqlite3 table - ERROR "Insert failed: datatype mismatch" I am using sqlite3 and I am writing my scripts in two files. The first one is called "Books.sql" 

DROP TABLE IF EXISTS Books;

CREATE TABLE Books (
    books_id INTEGER PRIMARY KEY AUTOINCREMENT,
    title TEXT,
    author TEXT,
);



The second one is called "Import_books.sql " 

.mode csv Books
.import C:/Users/Jim/books_data.csv Books


My goal is to import in "Import_books.sql", the csv file "books_data.csv" that contains a list of books into the table Books that I created in "Books.sql" 

I made sure the csv matches exactly the structure of the table but I get this error
INSERT failed: datatype mismatch. How can I solve this?
I tried to import using your csv format 

    CREATE TABLE Books1 (
    books_id INTEGER PRIMARY KEY AUTOINCREMENT,
    title TEXT,
    author TEXT
    );
    sqlite&gt; .mode csv
    sqlite&gt; .separator "-"
    sqlite&gt; .import books1.csv books1
    books1.csv:1: unescaped " character
    books1.csv:2: unescaped " character
    books1.csv:2: unescaped " character
    books1.csv:3: unescaped " character
    books1.csv:1: expected 3 columns but found 1 - filling the rest with NULL
    books1.csv:1: INSERT failed: datatype mismatch

I fixed csv removing quotes for each record and comma that separates records 

sqlite&gt; .import books1.csv books1
sqlite&gt; select * from books1;
337864-" Pride and Prejudice "-" Jane Austen"
783356-" Ivanhoe "-" Walter Scott"
987786-" Harry Potter and the Goblet of Fire "-" J.K. Rowling"


Did you notice hyphens after first two columns not neat.

I fixed csv file to correct format and this is the result 

sqlite&gt; select * from books;     
337864,"Pride and Prejudice","Jane Austen"
783356," Ivanhoe","Walter Scott"
987786," Harry Potter and the Goblet of Fire","J.K. Rowling"