Re: Referential integrity

From: Will <wkooiman_at_earthlink.net>
Date: 29 May 2002 22:45:02 -0700
Message-ID: <7256fcf8.0205292145.2a982fb6_at_posting.google.com>


sai_surya_mp_at_yahoo.com (surya) wrote in message news:<e4fde6e1.0205230328.41485342_at_posting.google.com>...
> I am having tow tables
>
> CREATE TABLE A1(
> Id CHAR(4),
> FileName CHAR(X),
> primary key(Id)
> )
>
> CREATE TABLE A2(
> Id CHAR(4) ,
> FileName VARCHAR(250),
> primary key(Id)
> )
>
> Whenever i update Table A1 column "FileName" with X the same record,
> with same Id,in Table A2 automatically need to be deleted. I need to
> maintain Referential integrity between both tables.
>
> Can you please suggest a Modified table quries for the above.
>
> Thanks in advance
> Surya

Referential integrity constraints enforce proper relationships between tables. A proper relationship is such that each FK points to exactly one PK. (crude definition for the sake of space)

You are trying to use referential integrity constraints to enforce relational database design rules, but you are ignoring other relational design rules. That is, you've created two tables with the same primary key. Now you want their PK's to also be FK's and for them to point to each other. It doesn't work that way.

I'm sure you have a reason to have two tables, but it looks like you should only have one. Received on Thu May 30 2002 - 07:45:02 CEST

Original text of this message