What's the point of “NOT NULL DEFAULT '' ”?

后端 未结 7 991
时光说笑
时光说笑 2021-02-01 05:10

I\'ve seen this on a lot of fields on a DB from a project I\'ve been working on, where a column will be defined not null, but will have an empty string as the default. what\'s t

7条回答
  •  天命终不由人
    2021-02-01 06:00

    Because sometimes, on some languages, a "select" query would give you the string NULL, and you would have to check if it's a real string with content "NULL" or it is really null.

    With "" it's easiest (IMHO)

提交回复
热议问题