I need to import a .csv file into a table based on the headers of the .csv file. The header of the .csv file contains the fields of the sql table but does not have optional fields. Does sqlite3 have the ability to do this?
For example, the table has the following schema:
CREATE TABLE "Names" (
id INTEGER PRIMARY KEY,
first TEXT NOT NULL,
middle TEXT,
last TEXT NOT NULL
);
The .csv has contains:
id,first,last
1,"Jane","Doe"
2,"John","Doe"
3,"Nikola","Tesla"
Does sqlite have the ability to load a .csv file that has missing fields into a sqlite table based on the header line in the .csv?
Something along the lines of this: How to import load a .sql or .csv file into SQLite?