Importing a CSV file to a SQLite Database

SQLite has a build in import command for importing records from text files. We used a tab for a field separator:

$ sqlite3 database.db
SQLite version 3.1.3
Enter ".help" for instructions
sqlite> .separator "\t"

Now that we have set our field separator, we can import:

sqlite> .import ex.txt tablename
sqlite>