Re: Help Data-Types

From: GoranG <no_at_spam.net>
Date: Mon, 19 Aug 2002 14:01:40 +0200
Message-ID: <pfn1mu8u6e6tph4gpcal282bsc6kcbpjfh_at_4ax.com>


On 18 Aug 2002 09:57:58 -0700, mikharakiri_at_yahoo.com (Mikito Harakiri) wrote:

>"Dave" <dave_at_dmcomm.com> wrote in message news:<_Ug79.27$Tl4.10801289@news.incc.net>...
>> Just a quick question on a datatypes since I'm a young novice.
>> What the heck would an IP address go under? Text? Integer (long, short?) ??
>>
>> Thanks for the help.
>> D
>
>Four integer columns?

My first idea as well. Seems that nothing is lost by normalizing and a lot is gained...

So, I am puzzled by amount of the answers that suggest contrary...

Is it so because the IP address is almost all ways used as a whole (in usual applications) and therefore should be thought of as whole in semantic sense? Unless you are modeling a router ;)

Similar to date datatype - if there were no date datatype we could model it as single real number or as three integers (both design require non trivial constrains).
Btw, what is relational purist answer/approach on the date data type?

Standard answer that I read to such questions is: It depends on the semantic model which depends on the intention of usage.

However, in most cases those data types might be used in both meanings (whole and parts) within the same system - not to mention that the usage might be unknown.

So is this why modeling is called art? since there are no definitive answers to these questions, and for every rule there are two exceptions?

Where do I read more about this?

>Then, enforsing constraints and querieng is the
>simplest of all. Alternatively, it could be just a single integer:
>
>a3*256^3+a2*256^2+a1*256^1+a0

My second idea as well. This seems more natural since it fits the actual data type (it'll even support IPv6). Data representation in xxx.xxx.xxx.xxx is considered formatting function (part of this formatting is data extraction). However textual representation seem cheaper (speed vs space costs), faster (in most cases, since it is already formatted) and better supported (bitwise operations are less supported compared to string functions - all IMHO)

Final digressions - does the following statement hold water?: For all proposed data types there exist semantics in which the proposed data type is the better then all other.

take care, all the best

( GoranG79 AT hotmail.com ) Received on Mon Aug 19 2002 - 14:01:40 CEST

Original text of this message