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

前端 未结 3 1205
名媛妹妹
名媛妹妹 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:39
    CREATE TABLE IF NOT EXISTS ...
    
    0 讨论(0)
  • 2021-01-17 08:49

    You can use:

    CREATE TABLE IF NOT EXISTS <name> (
      /* definition */
    )
    

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

    0 讨论(0)
  • 2021-01-17 08:57

    Use IF NOT EXISTS.

    0 讨论(0)
提交回复
热议问题