Re: Article claims the following table is not in 1NF
Date: Thu, 23 Oct 2008 13:43:28 GMT
Message-ID: <4c%Lk.3229$r_3.564_at_nwrddc02.gnilink.net>
<Srubys_at_gmail.com> wrote in message
news:c4b7b721-9c49-4cb7-bb08-2f2044d277ef_at_e17g2000hsg.googlegroups.com...
greetings
> 2) My book claims that if table is not normalized, then primary key
can’t be made out of just one attribute. But how can that ALWAYS be
true, since even if a table has multi valued attributes or duplicative
columns, we could still have an attribute ( ORDER_ID ) that would
uniquely identify the row:
If a table is not in 1NF, then it can't have a primary key at all. So the book's claim is true but meaningless.
> ORDER ( ORDER_ID, ITEM1, ITEM2, ITEM3 )
Now even though the above table has repeating columns ( ITEM1, ITEM2,
ITEM3 ), ORDER_NUM column would still be able to uniquely identify the
row!
consider the following:
SELECT ORDER_ID
FROM ORDERS
WHERE ITEM1 = 'LIGHTBULB'
OR ITEM2 = 'LIGHTBULB'
OR ITEM3 = 'LIGHTBULB'
BTW, you can substitute "candidate key" for "primary key" in the above with
no loss of meaning. A primary key is just a conadidate key that has been
chosen by the designer to be "primary".
Received on Thu Oct 23 2008 - 15:43:28 CEST