4 ms·
I had to do something very similar for analysing CVE information recently, but I don't remember having to use the :memory: option. I suspect it defaults to that
by kitd 4y ago
I had to do something very similar for analysing CVE information recently, but I don't remember having to use the :memory: option. I suspect it defaults to that if no .db file is specified.
Slightly tangentially, when doing aggregated queries, SQLite has a very useful group_concat(..., ',') function that will concatenate the expression in the first arg for each row in the group, separated by the separator in the 2nd arg.
In many situations SQLite is a suitable alternative to jq for simple tabular JSON.
- simonw 4y agoI just tried it without :memory: and it dropped me into the SQLite shell without executing the query: % sqlite3 -cmd '.mode csv' -cmd '.import taxi.csv taxi' \ 'SELECT passenger_count, COUNT(*), AVG(total_amount) FROM taxi GROUP BY passenger_count' SQLite version 3.36.0 2021-06-18 18:58:49 Enter ".help" for usage hints. sqlite>
- kitd 4y agoOk, I just went back to see what I did. In fact I echoed a script into sqlite via stdin, not by using `-cmd ''`. In that case, I didn't need to use the :memory: table, and sqlite exited normally when done.