How to create a datetime column with default value in sqlite3?

前端 未结 4 1125
甜味超标
甜味超标 2020-12-23 02:03

Is there a way to create a table in sqlite3 that has a datetime column that defaults to \'now\'?

The following statement returns a syntax error:

crea         


        
4条回答
  •  眼角桃花
    2020-12-23 02:47

    ... default (datetime(current_timestamp))
    

    The expression following default must be in parentheses. This form is useful if you want to perform date arithmetic using SQLite date and time functions or modifiers.

提交回复
热议问题