SQLite查询表是否存在
SQLite - 判断表是否存在
SELECT count(*) FROM sqlite_master WHERE type="table" AND name = "表名";
查询的结果
qlite> sqlite> SELECT count(*) FROM sqlite_master WHERE type="table" AND name = "t_food"; +----------+ | count(*) | +----------+ | 1 | +----------+ 1 row in set sqlite> sqlite> sqlite> sqlite> sqlite> sqlite> sqlite> sqlite> SELECT count(*) FROM sqlite_master WHERE type="table" AND name = "t_food2"; +----------+ | count(*) | +----------+ | 0 | +----------+ 1 row in set sqlite> sqlite>
####################3
QQ 3087438119