Re: Complicated query

From: Jerry Stuckle <jstucklex_at_attglobal.net>
Date: Thu, 11 Dec 2014 22:51:56 -0500
Message-ID: <m6doob$hna$1_at_dont-email.me>


On 12/11/2014 2:14 PM, Shelly wrote:

> On 12/11/2014 1:55 PM, Jerry Stuckle wrote:
>> On 12/11/2014 12:33 PM, Shelly wrote:

>>> On 12/9/2014 7:15 PM, Denis McMahon wrote:
>>>> On Mon, 08 Dec 2014 22:00:57 -0500, Shelly wrote:
>>>>
>>>>> On 12/7/2014 12:05 PM, richard wrote:
>>>>
>>>>>> I know this will piss off normalized Jerry Stuckle, but I'd just as
>>>>>> soon use one table.
>>>>>> Columns would be ID Question Achoice Bchoice Cchoice Dchoice Correct
>>>>>>
>>>>>> Now all you need to do is retrieve the row for each ID as needed.
>>>>
>>>>> Of course, and if *I* had designed the table structures, that is
>>>>> what I
>>>>> would have done as well.
>>>>
>>>> You are kidding us, right?
>>>>
>>>> Are you seriously working with Oracle products and preaching non
>>>> normalised database design?
>>>

>>> How is this non-normalized? You would label each of the answer fields
>>> with a unique name that illustrates the question to which it is an
>>> answer. You would then eliminate the question table entirely, unless
>>> you want to keep it with both the expanded question and the name of the
>>> field in the instance table for which it corresponds. In that table,
>>> the name would then be the foreign key. Since this only is to be used
>>> is designing the html user interface, it is really not needed as you
>>> could simply add the text explicitly. Thus you are down to only one
>>> table that is needed -- the instance table -- with n unique fields.
>>>

>>> So, pray tell, how is that non-normalized? Where is the redundancy? To
>>> what other tables need something here be propagated (none!).
>>>

>>> No, sir, it is not non-normalized. The "normalization" that exists now
>>> is an unnecessary complication.
>>>
>>>>
>>>> Also you seem to have lost the instance information somewhere along the
>>>> way. Hope that wasn't important.
>>>

>>> He was giving a short-hand. He *obviously* meant
>>>

>>> ID Instance-item-1 Instance-Item-2 (etc.) Question Achoice Bchoice
>>> Cchoice Dchoice (etc.)
>>>

>>> Apparently that was beyond your grasp.
>>>
>>
>> Shelly,
>>
>> It is a violation of First Normal form:
>>
>> "A relation is in first normal form if the domain of each attribute
>> contains only atomic values, and the value of each attribute contains
>> only a single value from that domain."
>>
>> Having multiple answers in one row violates the "single value from that
>> domain" (answers).
> 
> No, it doesn't if the fields all refer to DIFFERENT questions.  The fact
> that they are all answers to questions is meaningless.  They could just
> as easily been "department", "location", "address", etc. as being
> "answer to question 1", "answer to question 2", etc.
> 
> You would be correct if the columns were multiple answers to the SAME
> question.  In that case it would be non-normalized.  However, they are
> not so it isn't non-normalized since each column refers to a totally
> independent entity.
> 

No, the columns (not "fields") refer to different answers ("choices") to the question. It is a violation of first normal form.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex_at_attglobal.net
==================
Received on Fri Dec 12 2014 - 04:51:56 CET

Original text of this message