Creating an SQLite table only if it doesn't already exist

前端 未结 3 1206
名媛妹妹
名媛妹妹 2021-01-17 08:16

I need my PHP app to be able to create an SQLite table but only if it doesn\'t already exist. How should I go about it?

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-17 08:49

    You can use:

    CREATE TABLE IF NOT EXISTS  (
      /* definition */
    )
    

    Which is supported by SQLite (http://www.sqlite.org/syntaxdiagrams.html#create-table-stmt)

提交回复
热议问题