RE: RI question
Posted in 1995
Jon, From your description, I doubt if your primary key for TABLE1 is truly composed of col1, col2, col3. I'd say that either TABLE1.col1 is the true primary key or col1 is a foreign key to both TABLE1 and TABLE2. So, you could define col1 as the primary key or add a table which holds the data which is related to col1 but not dependent upon col2 and col3. (My! Don't these generic descriptions quickly grow old. Perhaps you could send a quick schema and some sample rows. Then the explanations wouldn't be quite so obscure.) --Craig (craig@chemistry.utah.edu) }I have a question. I'm interested in hearing how other people have }addressed this issue (if at all). } }I'm trying to enforce RI through the following means. } }A parent table (TABLE1) has a primary key defined, which is composed of }col1, col2, and col3. The child table (TABLE2) has a foreign key defined on }col1, which references (TABLE1.col1). } }This however does not work, since the primary key on TABLE1 is }(col1,col2,col3). } }How best to enforce RI ?? I could carry TABLE1.col2 and col3 in TABLE2, }then be able to create the foreign key reference, but I really don't need }to carry col2 and col3 in TABLE2. I thought there may be a way to create a }trigger to enforce, but I have not used triggers, so I'm not sure how. }