Hey friend don't get upset, I didn't create the sql and can't change it
either!
What's your point, do you want to change the sql ?
El 07/09/10 08:34, Rami Ojares escribió:
> > There he clearly stated that NULL is a data type with only one value named
> > NULL.
>
> As I said this is a matter of definition.
> You can go ahead and define a type with name NULL that has only one value
> which is NULL.
>
> But step aside for a second to a world where the concept of null was still
> not existing.
> Wouldn't you wonder why someone invented such a meaningless type and
> meaningless value?
I suppose that you never ever has needed to create a table with a nullable
column, right? Why?
Maybe nulls aren't so out of the world as you think.
"meaningless value" : what part of the sentence "absence of a know value"
don't understand ?
> > NULL is NOT equal to nothing because the null value is an irregularity in
> > any other data type
> > that only express or mean the absence of a known value.
I mean NULL is not equal to any value of any other type (even to itself).
Try in any database :
select null=null;
select cast(null as boolean) = cast(null as boolean) ;
select cast(null as boolean) = 1;
return NULL always.
> > null value is an irregularity in any other data type
>
> I can not figure out what this sentence could possibly mean.
SQL is a typed language, so if you select a column of INTEGER type it's
irregular (or wrong) that can obtain a value of type NULL.
>
> > that only express or mean the absence of a known value
>
> So if null means that a value is missing then it clearly is a metavalue.
> Value talking about the values.
> And thus I feel understanding toward the position that NULL IS NOT A VALUE
> like the other values in the database.
>
> > UNKNOWN is a descriptive term used for a NULL value in the evaluation of an
> > expression of boolean type.
>
> That sentence can not possibly mean anything.
>
> Here the first paragraph from Wikipedia article Null (SQL)
> Heading: History
> "Null was introduced by E. F. Codd as a method of representing missing data
> in the relational model <http://en.wikipedia.org/wiki/Relational_model>. Codd
> later reinforced his requirement that all RDBMS' support Null to indicate
> missing data in a two-part
> series published in /ComputerWorld/ magazine.^[1]
> <http://en.wikipedia.org/wiki/Null_%28SQL%29#cite_note-0> ^[2]
> <http://en.wikipedia.org/wiki/Null_%28SQL%29#cite_note-1> Codd also
> introduced a ternary (three-valued)
> <http://en.wikipedia.org/wiki/Ternary_logic> logic, consisting of the truth
> values <http://en.wikipedia.org/wiki/Truth_value> True, False, and Unknown,
> which is closely tied to the concept of Null. The Unknown truth value is
> generated whenever Null is
> compared with any data value, or with another Null."
My English is bad but not so bad to not understand that this citation match the
above concepts.
> > In any context where a expression must to be evaluated for a boolean result
> > ( for example in a where clause)
> > if any operand is null then the expresion value is UNKNOWN having no effect
> > in their context.
>
> What does "having no effect in their context"?
> Does it mean that the sql statement is silently ignored?
> That's what having no effect could mean.
ok, that was an imprecise and unfortunate phrase.
For context I refer to, for example, a boolean expression in a select list or
the same boolean expression in a where clause.
The difference it's that a null boolean exp. selected as value can be
externalized as a null value, but the same exp. in a where clause or check
constraint it's evaluated as UNKNOWN with the three-state truth's table.
To see my point just try this on any dbm:
select cast(null as boolean) as x ;
select cast(null as boolean) as x where cast(null as boolean);
> So you say that a boolean expression evaluates to UNKNOWN, yet UNKNOWN is
> just a descriptive term for NULL.
> Why not just say that boolean expression can evaluate to value NULL.
> But since NULL is not of boolean type but of type NULL (according to your
> sources) then the boolean expression
> like COL1 = COL2 can evaluate to null so the expression does not have ONE but
> TWO possible types: Boolean and Null.
> (So we need to evaluate the type of the expression at runtime, like in
> javascript).
>
Again, don't believe, try it yourself : select cast(null as boolean) =
cast(null as boolean) ;
> > NULL isn't comparable, but every implementation has the choice (or setup)
> > of an ordering convention for null values as FIRST or LAST values.
>
> But in a where clause you must produce some kind of decision.
>
> WHERE NULL > 1
>
( NULL>1 ) = null = UNKNOWN
> So what does the where-clause do?
Constraint the result set with unknown is equal to the empty set ( because you
can assure that condition it's true).
> Does it include the row?
No.
> Does it exclude it?
what do you think?
> Does it just get stuck and freeze?
On windows only
> Having a rather severe effect on the execution of the application.
>
> - Rami
Rami, I think you should drink less coffee and eat more fiber ... ;-)
Take it easy and regards,
Dario.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.