Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Can a PK be an FK as well ?

Posted on 2007-11-15
3
Medium Priority
?
1,117 Views
Last Modified: 2008-03-23
Hello,

Can a PK be an FK as well ?

Thank you.
0
Comment
Question by:matthew016
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 20

Assisted Solution

by:steelseth12
steelseth12 earned 800 total points
ID: 20292600
foreign key of one table is the primary key of another table.
For the field to be the primary key of table A and the foreign key of table B ... No. Foreign key needs to take the values from table B.
0
 
LVL 1

Accepted Solution

by:
kiwi_nz earned 1200 total points
ID: 20295410
yes a pk can be an fk - however this must be done in a special way. The trick is you must have two foreign keys that then composite into a Primary key - this is useful for when tables would otherwise have a many to many relationship you can put an intermediary table in between them and use the PK from each primary table as an FK in the intermediary table thereby creating a one to many - int table - many to one relationship.

Personally I dislike this method and always give the intemediary table a primary key and then add the two FK's thus making sure every single record in every single table is unique
0
 
LVL 9

Author Comment

by:matthew016
ID: 21189650
The answer was just yes, no special way needed
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this tutorial viewers will learn how to type text that isn't in a straight line by using the Type on a Path tool in Illustrator Open a document in Illustrator: Draw a path for the text to be typed upon. Don't worry about the fill or stroke as the…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question