Re: Is this bad design ?
Date: Thu, 11 Mar 2004 11:16:02 +0100
Message-ID: <40503C62.2020700_at_tzi.de>
If you refer to the solution I proposed:
Change a mother (mid) to invalid:
Change a mother (mid) to valid:
DELETE FROM ValidMother WHERE mother_id = mid
-- delete will fail if this mother has children (as intended)
INSERT INTO ValidMother(mother_id) VALUES (mid)
WHERE NOT EXISTS( SELECT * FROM ValidMother WHERE mother_id = mid)
Tables where:
ValidMother( mother_id primary key + foreign key ref Mother(mother_id))
-- "valid mother" ids
Child( mother_id foreign key ref. ValidMother(mother_id), more_fields)
Fabian
ben brugman wrote:
Mother( mother_id primary key, etc_fields )
-- all mothers
>>>But then the application has to be changed.
>>
>>No, it doesn't. A simple view serves the application well.
>>
>>
>
>
> If a view is used (I assume a union over both tables),
> how does the application change the data from
> valid to non-valid and vice versa ?
>
> ben
>
>
Received on Thu Mar 11 2004 - 11:16:02 CET