September 19, 2005 at 8:35 am
There is some confusion possible with the ambiguous word 'unknown'
True, Codd's rule 3 says "Null must always be interpreted as an unknown value" but 'unknown' is plainly used in the sense of an unitialized value i.e. no data was entered.
'Unknown' in the above example can be a very real value in the sense that it explicitly tells us that the information is not available or cannot be determined; not the same thing at all. This kind of differentiation is very important in many real world data sets.
[oops rule 3 not 4]
...
-- FORTRAN manual for Xerox Computers --
September 19, 2005 at 11:48 am
That brings up a very interesting point. When would I use nvarchar vs. varchar?
September 19, 2005 at 11:52 am
When you need to keep foreign dialects like chinese in the db. You need to use unicode for this task (N). Note that these datatypes take double the space of non unicode types.
September 19, 2005 at 12:14 pm
With the storage being so cheap right now, does it really matter? Unless it is a performance issue. I would consider using a varchar if I had to develop a database where network traffic would be high.
September 19, 2005 at 12:20 pm
If you really want to optimize it for performance, make it a tinyint. Create a lookup table with all the appropriate values in it and use that. Numerics are always faster than text.
As to null and unknown, I'll stick with Codd's definition of it. Why bother defining something that is already defined?
September 20, 2005 at 4:14 pm
Char vs varchar - There is more to it than just the extra 4 bytes of overhead for each varchar, fixed-length fields can be handled more efficiently than variable-length. Especially in indexes.
If you insist on confusing the use of "U" to indicate a known unknown with the uninitialized unknown NULL, then someone has to try coming up with a more precise definition.
November 24, 2005 at 8:30 am
My two pence:
I would define "NULL" as a never handled value.
"UNKNOWN" is a value to me, not something i missed, but something i quote as "UNKNOWN". And i really need to make the difference with "NULL" that means i never computed, evaluate or tell anything about it.
Again from a pure SQL syntax i would prefer write a single request :
"...WHERE something = '"+myvalue+"'..."
myvalue can here take the "unknown" value
NULL check needs a different syntax
"... WHERE something IS NULL..."
November 24, 2005 at 11:51 am
NULL is an unknown value.
But, entering UNKNOWN into a column as a value says that you have evaluated the input and there is enough information (or not) to define it as UNKNOWN.
And, yes they are 2 different things. I just normally do not burden my users with UNKNOWN as a selection since I can use NULL to do what they want to do with UNKNOWN.
November 27, 2005 at 1:45 pm
November 28, 2005 at 6:33 am
Only if you are....:-)
Viewing 10 posts - 16 through 24 (of 24 total)
You must be logged in to reply to this topic. Login to reply