You can import a CSV file into SQLite table by using sqlite3 tool and .import command. This command accepts a file name, and a table name.
Here, file name is the file from where the data is fetched and the table name is the table where the data will be imported into. In the absence of the table, it will create the table automatically according to the data in CSV file.
Let's take an example where we import the content of a CSV file to a table that doesn't exist currently. Let's name it "EMPLOYEE". It will create a table based on the data of CSV file.
.mode csv .import /Users/rookienerd1/Desktop/sqlite/student.csv EMPLOYEE
Now check if the table is created:
You can see that EMPLOYEE table is created. Now check the data in EMPLOYEE table:
.mode column SELECT * FROM EMPLOYEE;