Non Identifying relationship key issue
Yogesh Purabiya, March 01, 2011 - 10:31 pm UTC
... The issue here is that there are a few column from the composite pirmary key of the parent table which is part of the primary key of the child table ...
It is saying "few" of the columns - and "NOT" "ALL" of them
March 02, 2011 - 7:26 am UTC
doesn't matter, if the child primary key consists in part of the parent key, it is an identifying relationship. The child cannot exist without the parent.
Identifying relation:
create table document( doc_id primary key, .... );
create table document_version( doc_id references document, version, ..., primary key(doc_id,version));
Non-identifying
create table dept( deptno primary key, ... );
create table emp( empno primary key, deptno references dept, .... );
And note: not a single trigger ANYWHERE.
More information needed.
Chuck Jolley, March 02, 2011 - 12:21 pm UTC
subhadra,
I think it might help if you explicitly said whether ALL the columns from the parent's primary key are in the child table.
Regardless of whether they are part of the child's pk.
If they are, then just create the fk constraint like Tom said, and forget your worries. It doesn't matter whether some, none, or all of the columns in the foreign key are a part of the child table's primary key.
If some of the parent pk columns aren't in the child table and you can't add them to the child table because some business rule would be violated AND you need the reference to the partial parent primary key logically, then it's very likely that your ER design is incorrect.
March 02, 2011 - 12:43 pm UTC
A real world example would definitely help.