Re: How to ensure data consistency?

From: ddtl <fake_at_address.com>
Date: Wed, 08 Sep 2004 09:03:30 -0700
Message-ID: <46auj05c5ia04turqujjjm7rq97jn3d30c_at_4ax.com>


>> If that is so, it won't work (try it!).
>
>I just tried it: It seems to work (didn't try implementing any checks,
>though). What makes you believe that it doesn't?

I just wonder how new rows are going to be added to the main table - before you can insert anything into it, you have to fill in data into the seconday tables (otherwise, if they are empty, FK constraints in the main table will prevent adding rows, because FK fields have to reference an already existing data). Suppose you did just that, and want to insert the first item into the main table, and suppose that thit item belongs to a group 'b'. You fill in item's properties, and set b_id to one of the values in BS.b_id. But what do you do with TS.a_id, TS.c_id .... TS.N_id? You can of course have a dummy item in each of sub-tables, and set TS.a_id, TS.c_id etc. to it, but this will give you a *very* denormalized table (all those columns pointing to dummy values are completely redundant), which nullifies (and negates) all the efforts to enforce data integrity.

Besides, the same problem with the data integrity exists here - how can you ensure that the user, after inserting a new row into a sub-table, will update the main table accordingly? Received on Wed Sep 08 2004 - 18:03:30 CEST

Original text of this message