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

后端 未结 2 1623
醉梦人生
醉梦人生 2020-11-28 21:24

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

2条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 22:03

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

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

提交回复
热议问题