How can I avoid NULLs in my database, while also representing missing data?

前端 未结 8 2001
予麋鹿
予麋鹿 2020-12-12 14:19

In SQL and Relational Theory (C.J. Date, 2009) chapter 4 advocates avoiding duplicate rows, and also to avoid NULL attributes in the data we store. While I have

8条回答
  •  误落风尘
    2020-12-12 14:40

    NULLs are required - theres no need to replace them

    The enitre definition of NULL is that its unknown - simply replacing this with arbitrary type is doing the same thing, so why?

    For the comments below:

    Just tried this - neither is true:

    declare @x char
    set @x = null
    
    if @x = @x
    begin
    select 'true'
    end
    
    if @x <> @x
    begin
    select 'false'
    end
    

    I can only take this to mean that because null is unknown then it can't be said that it equals or does not equal - hence both statements are false

提交回复
热议问题