setting a default value to a column in SQLite

后端 未结 1 1013
醉梦人生
醉梦人生 2020-12-20 17:59

I am having an SQLite table and wish to set it with a default value for time being. how can I do that?

Below is my DatabaseHelper class code:

import          


        
相关标签:
1条回答
  • 2020-12-20 18:34

    I believe you can do this:

    arg0.execSQL("CREATE TABLE finalP(_id INTEGER PRIMARY KEY AUTOINCREMENT,time TEXT DEFAULT \'50\');");
    

    and it should work fine.

    See the sqlite docs for column constraints. http://www.sqlite.org/syntaxdiagrams.html#column-constraint

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