-
Referential Integrity
Can a DB table have a foreign key and not a primary key? I have a key in one table that references a primary key in another table.
-
More Referential Integrity
Also can you have a primary key that references a primary key in another table?
Thank you
-
A foreign key can only exist if there is a primary key to reference. The PK referenced by the FK can be on a different table (as is usually the case), but could be on the same table as the FK (so the table is "self-referential").
A table does not need to have a PK in order to have FK's (this is often the case with data warehouse fact tables).
A PK does not reference another PK -- PK's don't reference other contrainsts at all, in the way that FK's do.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|