sqlite database default time value 'now'

前端 未结 7 1473
温柔的废话
温柔的废话 2020-11-27 09:28

Is it possible in a sqlite database to craete a table that has a timestamp column that default to DATETIME(\'now\') ?

Like this:

CREATE          


        
相关标签:
7条回答
  • 2020-11-27 10:25

    i believe you can use

    CREATE TABLE test (
      id INTEGER PRIMARY KEY AUTOINCREMENT,
      t TIMESTAMP
      DEFAULT CURRENT_TIMESTAMP
    );
    

    as of version 3.1 (source)

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