Referencing Primary key twice in one table
Is it possible to create 2 foreign keys from the same primary key, both of them in the same table?
This is a simplified version of the tables I want to create:
Supplier Table
-supplier_id(primary key)
-supplier_name
Asset table
-Asset_id
-Supplier_id(foreign key 1)
-ServicedBy_Supplier_id(foreign key 2)
If this is possible how can I make them refer back to the same primary key?
It does not support Cascade delete and update in both the foreign keys ?
What is the solution for this ?
Loading

ChristianPosted Jan 31, 2008, 12:46 AM
I agree with the above poster in that this is a normalization problem. Even if the list of companies that sell your asset are EXACTLY the same as companies that provide maintenance, your foreign key will cause problems by violating the one column to one column relationship.
One solution is to split the seller/maintenance table in to two different tables. With proper indexing, even a large table will be give results quickly.
Jan MontanoPosted Jan 30, 2008, 12:43 AM
With proper normalization of your database, you'll be able to eliminate this requirement.