sql插入默认值为当前时间 乔乐共享默认值自增长当前时间
程序员文章站
2024-03-19 21:05:10
...
mysql> desc message; +---------+--------------+------+-----+-------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------+--------------+------+-----+-------------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(20) | YES | | NULL | | | content | varchar(500) | YES | | NULL | | | time | timestamp | YES | | CURRENT_TIMESTAMP | | +---------+--------------+------+-----+-------------------+----------------+ 4 rows in set (0.02 sec)
CREATE TABLE mytable ( mydate TIMESTAMP DEFAULT CURRENT_TIMESTAMP, ....)