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

后端 未结 7 855
时光说笑
时光说笑 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 05:52

    null and "" are not the same thing, so there is no contradiction here.

    What the semantic meaning of null/"" is depends on the individual and is often a "religious" issue. To some people in some schemas, of course, they may be the same, but they don't have to be. For example, a "" might mean "I explicitly asked the user for input, and they chose to enter nothing" while a null might mean "I never even asked for input".

提交回复
热议问题