sqlite3 access via bash

INSERT into DB from BASH

1
2
3
4
5
mName="Last name, First name"
mSize="shoe 45"
mCat="student"

sqlite3 sqlite-database-file.db "insert into tableNameInDb (fieldA,fieldB,fieldC) values ("$mName", "$mSize", "$urlBase$mPath", "$mCat");"

OUTPUT AS CSV in BASH

1
sqlite3 sqlite-database-file.db ".mode csv" "select fieldA,fieldB,fieldC from tableNameInDb ORDER BY fieldB DESC;" > tmp_current_dump.csv