sqlite数据库判断表是否存在,如果表存在则删除的方法
发布:智码IT网 阅读:
-- 1、仅仅是判断表是否存在:
SELECT count(*) from sqlite_master where type='table' and name='tableName'
-- 存在:1 不存在:0
-- ------------------------------------------------------------------------------
sqlite_master表包含了表、索引等信息,其中sql字段存储了建表的SQL语句
--------------------------------------------------------------------------------
-- 2、如果表存在,则删除
DROP TABLE IF EXISTS "tb1";