Re: So what's null then if it's not nothing?



In article <1132912144.091433.13610@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
michael@xxxxxxxxxx says...
> > Ok. Let's say that the empty string can be called "no value at all" for
> > a text variable. What is "no value at all" for an integer variable?
> > --
> > Jon
>
> Well Jon - I'd say they're both NULL. NULL is type-less.

That is a bit troublesome if you like strong typing, as I do. But let
that pass.

> In the case of
> "no value at all" for an integer variable we can't store an empty
> string so we would store NULL.

I wonder a little how you can say you can store NULL, but not the empty
string, in the integer variable. If NULL is typeless, and "" is the same
as NULL, surely "" is typeless too? What is the logical difference
between decreeing that any variable can be NULL, and that any variable
can be "", regardless of type? But let that pass.

> I know a lot of educated people will
> tell me that NULL, when compared to any other value, results in
> Unknown.

If we're talking SQL, probably. Alternatively, it results in NULL, which
may or may not be something other than Unknown. But let that pass.

> I'd agree - if I agreed that NULL was unknown - or missing -
> or absent - or not, in fact, data. I believe that NULL is, correctly,
> "no value at all".

I don't understand this discussion. The behaviour of NULL in SQL is
pretty well-defined, although it can be discussed how consistent and
intuitive it is. But I can't see how it can be possible to have an
objective definition of what it *means*. Unknown, missing, absent, "no
value" are not mutually exclusive to me; neither are they really
comparable. A value can be missing *because* it is unknown, no? And
isn't "absent" and "missing" synonymous, and don't they imply that there
is no value? My gut feeling is that the DB designer should specify what
hir NULLs mean in each table. In fact, that should be done for all
attributes, regardless of whether they allow NULLs or not. But let that
pass.

My question is this:

You say the empty string is the same as "no value at all", and say we
should call this concept of "no value at all" NULL for other data types.
Now, the empty string is a perfectly normal string. You can do string
operations on it: concatenate it, find its substring, find its length
and so on. For an integer variable that is NULL, it is very different.
You cannot do integer operations on it; you cannot add it to another
integer, or multiply it, for example.

Doesn't this bother you? That for string variables, your NULL is just
like any other string, but for integers (and all other types I can think
of at the moment), it is something very peculiar?
--
Jon
.



Relevant Pages

  • Re: So whats null then if its not nothing?
    ... clearly that missing data should be exactly that - missing, ... Sorry vc - was it Jon that made that point? ... explain how an empty string differs from a NULL string? ...
    (comp.databases.theory)
  • Re: So whats null then if its not nothing?
    ... Jon Heggland wrote: ... Maybe it's more along the lines of every data type must allow NULL. ... > string, in the integer variable. ... In other environments with strong typing then an empty string ...
    (comp.databases.theory)
  • Re: Oracle NULL vs revisited
    ... empty string hold? ... NULLs are unknown unknowns. ... You concatenate blank with a string, and you simply get the string ... I'd say NULLs are readily distinguishable from blank strings. ...
    (comp.databases.oracle.server)
  • Re: Oracle NULL vs revisited
    ... empty string hold? ... NULLs are unknown unknowns. ... You concatenate blank with a string, and you simply get the string ... Oracle just messed up on varchar2 and NULL. ...
    (comp.databases.oracle.server)
  • Re: Oracle NULL vs revisited
    ... Shakespeare wrote: ... empty string hold? ... NULLs are unknown unknowns. ... You concatenate blank with a string, and you simply get the string ...
    (comp.databases.oracle.server)