Re: Is this bad design ?

From: Bob Badour <bbadour_at_golden.net>
Date: Tue, 9 Mar 2004 21:29:59 -0500
Message-ID: <T6KdnTHs4vme49Pd4p2dnA_at_golden.net>


"ben brugman" <ben_at_niethier.nl> wrote in message news:404c9b34$0$281$4d4ebb8e_at_read.news.nl.uu.net...
> Mother table.
> fields:
> mother_id
> still_valid boolean
> etc_fields
>
> Child table
> fields:
> mother_id
> still_valid boolean
> more_fields
>
>
> The child.still_valid field always contains a true, because only mothers
> withs are still_valid can have children, to enforce this; a relation is
> defined on the fields mother_id and still_valid.
> (A child can not exist without its mother).
>
> Because a field in the child table always has the same value, I think
> there is something wrong. But if this field is taken away a mother might
> become un_valid by another action.
>
> Is this bad design ?
> what is a alternative ?
>
> (As I understand constraints should be implemented in the RDBMS and
> not in the code).

Yes, it is a bad design. The Valid_Mothers relvar has no need for the boolean attribute and the Valid_Children relvar has no need for the boolean attribute. Valid_Children has a simple reference to Valid_Mothers.

The existence of a tuple suffices as a statement of truth, which is why DEE and DUM are such important relations. Received on Wed Mar 10 2004 - 03:29:59 CET

Original text of this message