Primary and foreign keys?

You'll get better answers if you post the DDL of the table. (Post the CREATE TABLE script. ) As a rule of thumb, always post DDL and INSERT statements for sample data Question is: can the primary key of a table also be a foreign key in that same table?

Yes, but that doesn't descibe your situation. Your primary key is in one table (Table B), and your foreign key is in a different table (Table A) A self-referencing foreign key, in which a foreign key in Table A references a candidate key that's also in Table A, is relatively uncommon. That is, foreign keys that reference other tables are much, much more common than foreign keys that reference their own table In fact, you can find quite a few designs on SO--and not just on SO--that use self-referencing foreign keys when they really shouldn't.

That's another good reason to post DDL Later What I'm asking is once I strip out the partial dependencies into their own tables, will the components of my key also become foriegn keys to reference the new tables? Yes. There are rare instances where the columns of a multi-column candidate key actually need to reference different tables entirely.

But in your case, it looks like you're right--the columns of your key should reference the primary keys in the new tables.

You'll get better answers if you post the DDL of the table. (Post the CREATE TABLE script. ) As a rule of thumb, always post DDL and INSERT statements for sample data.

Question is: can the primary key of a table also be a foreign key in that same table? Yes, but that doesn't descibe your situation. Your primary key is in one table (Table B), and your foreign key is in a different table (Table A).

A self-referencing foreign key, in which a foreign key in Table A references a candidate key that's also in Table A, is relatively uncommon. That is, foreign keys that reference other tables are much, much more common than foreign keys that reference their own table. In fact, you can find quite a few designs on SO--and not just on SO--that use self-referencing foreign keys when they really shouldn't.

That's another good reason to post DDL. Later What I'm asking is once I strip out the partial dependencies into their own tables, will the components of my key also become foriegn keys to reference the new tables? Yes.

There are rare instances where the columns of a multi-column candidate key actually need to reference different tables entirely. But in your case, it looks like you're right--the columns of your key should reference the primary keys in the new tables.

Unfortunately, I don't have the DDL right now. I'm only actually designing the tables out on paper right now. Editing original post with more information.. – MGZero Jul 5 at 14:31.

MGZero -- you seem to have changed the description of the problem. – Damir Sudarevic Jul 5 at 14:39 Yes, that's exactly what I mean! :) The problem is the same, I just did not feel that I described it properly originally, so I posted more information.

Your diagram shows what I was getting at. – MGZero Jul 5 at 14:39 What did you use to create that diagram, btw? – MGZero Jul 5 at 14:47 @MGZero -- CA ERwin – Damir Sudarevic Jul 5 at 15:26.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions