NULL vs DEFAULT NULL vs NULL DEFAULT NULL in MYSQL column creation?

前端 未结 2 777
孤独总比滥情好
孤独总比滥情好 2021-01-01 11:17

Following SQL table definition is illustrated one of create table statement from my MYSQL database which is developed by a former developer of my company.

DRO         


        
2条回答
  •  清歌不尽
    2021-01-01 11:52

    There is no difference. NULL DEFAULT NULL is the implicit default.

    From the CREATE TABLE documentation:

    • If neither NULL nor NOT NULL is specified, the column is treated as though NULL had been specified

    From the "Data Type Default Values" chapter:

    • If a column definition includes no explicit DEFAULT value, MySQL determines the default value as follows: If the column can take NULL as a value, the column is defined with an explicit DEFAULT NULL clause.

提交回复
热议问题