troubleshooting Question

A Question on Foreign Key Constraints

Avatar of Cyber-Storm
Cyber-Storm asked on
Microsoft SQL Server 2008
4 Comments1 Solution342 ViewsLast Modified:
Hi there,

Lets say I have 3 tables, Employees, Rates and Work
Employees has a PK on the Employee Code.
Rates has a Foreign Key to the Employees table for the Employee Code. It's PK is on the Employee Code and the Rate (since there are multiple rates per employee).

Finally the third table holds all the Work the Employees do as well as the Rate they're doing it at.
Should this table have a Foreign Key to both the Employee and Rates table or only the Rates table since it already has a FK to the Employee table?

Could you also please go into a little more detail as to why you say either yes or no (a simple link to a page explaining what is best would be fine too).

I'm just not sure if you're overdoing it if you're adding 2 FK's or if that's the right way to ensure your data integrity.

Many Thanks,

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros