SQLite 查询

常用命令

打开SQLite数据库:

sqlite3 ios_2129040928_1000366_20210811144515_id0BdzLV_KSong.sqlite

配置输出格式

https://geek-docs.com/sqlite/sqlite-tutorial/sqlite-tool.html
默认情况下,输出模式为line,分隔符为|

sqlite> .separator :
sqlite> .mode column
sqlite> .headers on

查询每个表占的空间

https://www.sqlite.org/dbstat.html

sqlite> select name,sum(pgsize)/1024 as pgsize_kb from dbstat group by name order by pgsize_kb desc;
name               pgsize_kb
-----------------  ----------
ZKSCOMMONCONFIGCD  177536
ZKSUGCUSERCD       22896
ZKSUGCCD           8612
ZKSUGCCOMMENTCD    2988
ZKSUGCPLAYBACKCD   2664
ZKSBULLETCURTAINC  2260
ZKSUGCRELATIONSHI  1364
ZKSINGLEFEEDCD     1128
ZKSUGCHCEXTRAINFO  740
ZKSUGCRELATIONSHI  316
ZKSUGCHCEXTRAINFO  288
ZKSUGCCOMMENTCD_Z  212
ZKSUGCCOMMENTCD_Z  212
ZKSSONGINFOCACHEC  196
ZKSNOTIFICATIONIN  184
ZKSUGCCD_ZUSER_IN  32
ZKSAVATARCACHECD   28
ZKSUGCCD_ZHCEXTRA  28
Z_MODELCACHE       20
sqlite_master      20
ZKSPLAYHISTORYCD   12
ZKSFLOWERRANKCD    4
ZKSIMAGECACHECD    4
ZKSIMPLEFEEDCD     4
ZKSIMPLEFEEDCD_ZS  4
ZKSIMPLEFEEDCD_ZS  4
ZKSIMPLEFEEDSONGC  4
ZKSIMPLEFEEDUSERC  4
ZKSSINGPLAYMASKCD  4
ZKSVISITORINFOCD   4
ZKSVISITORITEMCD   4
ZWEBASYNCSTORAGE   4
Z_METADATA         4
Z_PRIMARYKEY       4

你可能感兴趣的:(SQLite 查询)