Discussion Locked

Define NULL

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

since it came up in a discussion about sql.
I figured I would ask here.
what is the definition of NULL in sql,
c, c++,
java,
perl,
python.

and from where do you get this definition?

the discussion I'm pulling this querstion from:

In SQL, NULL means "unknown value". How could you assert that two NULLs are equal?

which doesn't make mathematical sense.
mathwise null is an empty result.
so setting the logic up using the math logic, null values are always equal.

What kind of mathematics you are speaking?
For example you have "infinity" where infinity is never
equal to infinity.
Same with null. Which is "unknown" or "undefined"
So if x is undefined and y is undefined you cannot
assume x=y - because if you assume this, then
they would not be undefined anymore.

9 replies

by thechas

As I understand it, a NULL value or result is the result of a blank data field.

When you open a new spreadsheet, all cells have a value of null.

When a result has not been placed into a data register, the result from reading that register is null.

When a calculation produces no result, such as divide by zero, when you look at the results register, there will be no value there, thus the result is null.

Any NULL result is an indication of an error with the program being run.
Either the formulas are wrong, or required data is missing.

Null data is never the result of a properly executed function. Any function that results in null data should raise an error flag.

Even a compare function should be designed to raise a flag for empty or null data registers.

Often, in programs that rely on mathematical functions, rather than leaving data registers at the last state, or a null state, the first action of the program is to fill the data registers with zeros.

Chas

by jaqui

the origin of the discussion, adding an index key to an sql table to a field that has "null" entries.

this is an offshot questioning the definition of NULL. it's my opinion that a NULL has no value whatsoever, so all NULL entries are identicle.

the other party is saying NULL is undefined value.

undefined or unkown is not the same as no value.
when writing programs, checking for a NULL is used to ensure a value has been assigned. ( for error checking naturally )
in an sql transaction, adding to the database, not putting a value into a field in the record is a NULL entry.
is this an undefined value, or an unknown value, or a complete lack of value?

by willcomp

Hey Chas, good writeup.

As best my foggy old brain remembers, in boolean logic null equates to empty. Same thing in database applications (which, surprise! surprise!, use boolean logic for sorts).

So in that case it follows that empty fields have equal values.

Dalton

by willcomp

Jaqui,

re: your comment

Basically, I'm agreeing with you. A database search for field contents contain (or equal) null should return records for which that field is empty (contains nothing). At least that's how it worked in Clipper many moons ago. Haven't worked with SQL, but boolean logic is boolean logic.

Dalton

by john.a.wills

In VBA null is NOT equal to null. There is a test function isnull() to determine whether a particular item is null.

by jaqui

okay, boolean operation isnull exists in all languages, not just the limited use vba. ( only works on one plaform, limits usefulness )
but that doesn't really answer the question. what is the value of NULL? in all the languages I know it is an empty result / variable, with no value.

This discussion is closed to new replies.