【发布时间】:2012-05-05 22:52:32
【问题描述】:
让 SQLite 数据库有效执行的最佳 SQL 是什么:
If Database Table Exists then
- create table
- insert row
- insert row (i.e. for startup data)
end
【问题讨论】:
标签: sqlite
让 SQLite 数据库有效执行的最佳 SQL 是什么:
If Database Table Exists then
- create table
- insert row
- insert row (i.e. for startup data)
end
【问题讨论】:
标签: sqlite
要检查您的表是否存在,您可以使用:
SELECT * FROM sqlite_master WHERE name ='myTable' and type='table';
【讨论】:
您可以让 Sqlite 自己为您检查:
CREATE TABLE IF NOT EXISTS <table_name> ...;
【讨论】:
使用此代码
SELECT name FROM sqlite_master WHERE type='table' AND name='yourTableName';
如果返回数组计数等于1,则表示表存在否则不存在。
【讨论】: