On Fri, 09 Nov 2007 15:55:29 -0000,
lawpoop@gmail.com
wrote:
>On Nov 8, 5:49 pm, Kees Nuyt <k.n...@nospam.demon.nl> wrote:
>> On Wed, 07 Nov 2007 20:26:15 -0000, lawp...@gmail.com
>> wrote:
>>
>>
>> Theoretically, for purists, this schema is not normalized.
>>
>> Think of it as this:
>> A table is a common name for a relation.
>> The table you have here represents two different and
>> incompatible relations:
>> - the relation between an id and a question,
>> - the relation between an id and its parent.
>>
>> Correcting this would give:
>> t1
>> id | question
>> -------------------
>> 1 | "Yes or no?"
>> 2 | "Orange or Yellow?"
>> 3 | "Sugar or cream?"
>>
>> t2
>> id | parent_id
>> --------------
>> 2 | 1
>> 3 | 3
>>
>> Quote:
>> SQL's "Nulls" Are A Disaster 
>
>Thanks, Kees, this is exactly what I was looking for. Is there a name
>for this type of relationship, or a common naming convention for these
>two tables? E.g. "many-to-many" is a common name for a intermediary
>table that joins two tables. Is there also a common name for table 2
>is your example?
Hm, I'm not aware of common naming conventions for these
tables.
You could call t1 Questions, and t2 Questions_Adjacency,
or Questions_Hierarchy.
--
( Kees
)
c[_] A closed mouth gathers no feet. (#153)