Create table in SQLite only if it doesn't exist already

≡放荡痞女 提交于 2019-11-26 10:17:47

问题


I want to create a table in a SQLite database only if doesn\'t exist already. Is there any way to do this? I don\'t want to drop the table if it exists, only create it if it doesn\'t.


回答1:


From http://www.sqlite.org/lang_createtable.html:

CREATE TABLE IF NOT EXISTS some_table (id INTEGER PRIMARY KEY AUTOINCREMENT, ...);


来源:https://stackoverflow.com/questions/4098008/create-table-in-sqlite-only-if-it-doesnt-exist-already

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!