Re: The BOOLEAN data type

From: Anith Sen <anith_at_bizdatasolutions.com>
Date: Thu, 10 Apr 2003 16:14:35 GMT
Message-ID: <LLgla.54037$ja4.3489134_at_bgtnsc05-news.ops.worldnet.att.net>


Steve,

>> Just because an operation exists for a type doesn't mean it has to make
sense for every entity represented by that type. <<

Well, define your own type, then.

I think you misinterpreted Bob's point. The Boolean type has only two values (true, false) and a set of operators that apply to them. If your business model requires values other than true or false, then you need to define another domain with relevant values & associated operations those values support and use this domain in your logical model. If gender in your business model means, 'male' and 'female' (note, these are character strings), then create a domain along the lines of :

TYPE gender POSSREP ( CHAR );

     OPERATOR (<>, = );

You can define your own operators based on your requirements as well like:

OPERATOR xyz (g1 CHAR, g2 CHAR) RETURNS CHAR

     RETURN (IF g1 = g2 THEN g1 ELSE '') ; END OPERATOR; Types allow the user to meaningfully compare the values in a logical model against other values in the same domain. Also note that the operators, being type-defined, will disallow other meaningless comparisons like concatenation, >=, < etc. Thus the DBMS will know exactly which expressions are legal and the type of the result for each such legal expression. It can preserve domain integrity efficiently thereby, knowing which assignments and comparisons are legal as well.

Simply trying to create a comparable logic in a language (case in point, SQL) which does not even support the basic concept of domains does not hold water in this case.

--
- Anith
(Please respond only to newsgroups)
Received on Thu Apr 10 2003 - 18:14:35 CEST

Original text of this message