SQLite is extremely flexible as it also allows the SQLite specific dot commands in the SQL syntax, (although they are interpreted by CLI.) This means that you can do things like this.
Create a sms
table like this:
# sqlite3 mycool.db '.schema sms'
CREATE TABLE sms (_id integer primary key autoincrement, Address VARCHAR, Display VARCHAR, Class VARCHAR, ServiceCtr VARCHAR, Message VARCHAR, Timestamp TIMESTAMP NOT NULL DEFAULT current_timestamp);
Then two files:
# echo "1,ADREZZ,DizzPlay,CLAZZ,SMSC,DaTestMessage,2015-01-24 21:00:00">test.csv
# cat test.sql
.mode csv
.header on
.import test.csv sms
To test the import of the CSV file using the SQL file, run:
# sqlite3 -csv -header mycool.db '.read test.sql'
In conclusion, this means that you can use the .import
statement in SQLite SQL, just as you can do in any other RDB, like MySQL with LOAD DATA INFILE
etc. However, this is not recommended.