Can a foreign key also be used as the primary key in the same table?
Jennifer S
2006-11-20 12:49:26 UTC
Can a foreign key also be used as the primary key in the same table?
Three answers:
Innocence Redefined
2006-11-20 19:35:08 UTC
I suppose u're talking about relational-database & not about encryption... the answer is no, if u use an attribute as a foreign key in a table (say, T1) then it clearly suggests that it's a primary key in another table except T1 (say,T2).
If u use the foreign key as the primary key in the same table, then u're violating the rule of 'referencial integrity' too. A foreign key is not at all a key-attribute in a table (i.e. this f.key attribute isn't a unique identifier by which u can distinguish a tuple from other tuples, okay?) Rather, a foreign key is a reference to a key in another table.
N.B.- I've written on basis of SQL
wallsatlarge
2006-11-20 19:23:53 UTC
Yes - (encryption has nothing to do with it of course). It would be a tag along table (extension if you will) because the primary key is shared with another table (Foreign key to other table as its primary).
jack
2006-11-20 12:52:27 UTC
Depending on the encryption used.
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.