SQL: Using NULL values vs. default values

前端 未结 13 2257
南旧
南旧 2020-12-01 01:28

What are the pros and cons of using NULL values in SQL as opposed to default values?

13条回答
  •  没有蜡笔的小新
    2020-12-01 02:10

    To me, they are somewhat orthogonal.

    Default values allow you to gracefully evolve your database schema (think adding columns) without having to modify client code. Plus, they save some typing, but relying on default values for this is IMO bad.

    Nulls are just that: nulls. Missing value and a huge PITA when dealing with Three-Valued Logic.

提交回复
热议问题