Re: How to ensure data consistency?
Date: Fri, 10 Sep 2004 02:35:57 +0200
Message-ID: <20040910023557.5438db54.felix.klee_at_inka.de>
On Thu, 9 Sep 2004 01:46:28 +0200 Felix E. Klee wrote:
> To avoid orphaned rows in subtables, it seems necessary to set up
> circular foreign key constraints.
Just checked it, and it seems to work fine. To avoid an overload of new key values one could use the following model. Again checks that b is non null when spcialization_type="b", etc. need to be added. But this seems to be simple. The disadvantage of the model is of course that it contains at least one null value in each row in TS.
TS
BS
CS
t_id (PK)
specialization_type: Either "a", "b", or "c".
b_t_id (UNIQUE) (FK->t_id) (FK->BS.t_id)
c_t_id (UNIQUE) (FK->t_id) (FK->CS.t_id)
[...]
t_id (PK) (FK->TS.t_id)
[...]
t_id (PK) (FK->TS.t_id)
[...]
Felix Received on Fri Sep 10 2004 - 02:35:57 CEST