Show all tables
.tables
Create table (don’t forget semicolon at end)
create table [if not exists] <name> ( ... );
Describe table
.schema <table>
;
at the end.header on
.mode column
pragma table_info("<table>")
Insert Query
insert into <table> (<col1>, <col2>, ...) values (<v1>, <v2>, ...), (<vk>, <vl>, ...);
Update Query
update <table> set <key> = <val>, ... [from select ...] where <key> = <val>;
Distinct Query
select distinct col1, col2 from table;
Delete Query
delete from table where col = val;
Count Query
select count(*) from table;
Backup Sqlite3 (non-interactively)
$ sqlite3 <name>.db ".backup '<name>.backup.db'"
xz
$ xz --compress --threads=0 --quiet <name>.backup.db