I’m having trouble importing a table from a .csv file to a newly created table. The details are as follows (this is for a final project of an SQL online course, and I’m using sqlite3 and a newly installed SQLite Studio v3.4.4):
-
the .csv file is called cheese_prodution and is composed by tables Year, Period, Geo_Level, State_ANSI, Commodity_ID, Domain and Value; these are not separated by commas, they are in fact worksheet columns.
-
the table created in the database also has the same columns. It was created with the following script:
CREATE TABLE cheese_production (
Year INTEGER,
Period TEXT,
Geo_Level TEXT,
State_ANSI INTEGER,
Commodity_ID INTEGER,
Domain TEXT,
Value INTEGER
);
- right-click cheese_production table -> Import Into the Table -> choosing cheese_production as the “Table to import To” and clicking Next -> selecting input file as cheese_production.csv, Text Encoding “System” and clicking “Next” however the other (relevant) fiels are selected or not -> Status window reports “Error while importing data: table cheese_production has no column named Year”.
I went to a couple of FAQs from SQL Lite, tried several .csv file structures and corresponding importing format options, but all failed with the same error. I feel like I’m missing something very basic, but I’m unable to find what it is.
I’m just looking for importing values from a .csv file to an already created table.
Can somebody help me on this, please? Thanks in advance!
João Líbano Monteiro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1