Re: Multiple-Attribute Keys and 1NF

From: Keith H Duggar <duggar_at_alum.mit.edu>
Date: Mon, 03 Sep 2007 19:01:27 -0700
Message-ID: <1188871287.363023.250270_at_w3g2000hsg.googlegroups.com>


JOG wrote:
>
> Brown -> live.
> Red -> live
> Blue -> neutral.
> Black -> neutral.
> Green and yellow -> earth.
>
> The issue with encoding these propositions is that the candidate key
> for each proposition may consist of one _or_ two colours. Now I have a
> couple of options, none of which seem satisfactory. I could leave
> green & yellow as some sort of set-value composite, but obviously this
> would affect my querying capabilities, so thats out straight off the
> bat. Similarly adding attributes Colour1 and a nullable Colour2 is
> simply so hideous it isn't worth consideration.

Dumb question here. What would be wrong with a second color that is not nullable?

Type Color1 Color2
====== ====== ======
live Brown Brown
live Red Red
neutral Black Black
neutral Blue Blue
earth Green Yellow

That seems quite usable to me. Also, I seem to recall wiring situations having codes such as red wires with white stripes and white wires with red stripes. The scheme above can cover such cases as well.

Type Base Stripe
====== ====== ======
live Brown Brown
live Red Red
neutral Black Black
neutral Blue Blue
earth Green Yellow
casing Yellow Green

Here is even a "real" example of such base/stripe codes:

http://continuouswave.com/whaler/reference/wireColorCode.html

KHD Received on Tue Sep 04 2007 - 04:01:27 CEST

Original text of this message