【MySQL】建表时设置create

    技术2022-07-10  102

    create_time:

    设置数据类型为:TIMESTAMP,默认值为:CURRENT_TIMESTAMP()

     

    modify_time:

    设置数据类型为:TIMESTAMP,默认值为:CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP()

     

    SQL语句为:

    CREATE TABLE `base_name`.`table_name` ( `create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP(), `modify_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP());

    Processed: 0.009, SQL: 9