473,395 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

multiple foreign keys on same column

i've been googling this for hours and can't seem to find an answer.
i'm a student that's new to oracle and i'm designing a database for a construction company. i have a contacts table that stores contacts for their clients and subcontractors. i originally designed the database in access and have an employer_id field that references the client_id in the client table and the subc_id in the subcontractor table. in oracle, i have two foreign key constraints. the client_id starts at 10,000, the subc_id starts at one and goes up to 9999. when i enter a row in the contacts table, it causes a problem since the record only satisfies one of the constraints.

so is it possible to have a column in an oracle database that references two seperate columns but only has to satisfy one of the FK constraints?


btw, you can see the ERD here: http://www.auburn.edu/~shanncb/db/relationships.bmp
Nov 28 '06 #1
1 4962
pragatiswain
96 Expert
i've been googling this for hours and can't seem to find an answer.
i'm a student that's new to oracle and i'm designing a database for a construction company. i have a contacts table that stores contacts for their clients and subcontractors. i originally designed the database in access and have an employer_id field that references the client_id in the client table and the subc_id in the subcontractor table. in oracle, i have two foreign key constraints. the client_id starts at 10,000, the subc_id starts at one and goes up to 9999. when i enter a row in the contacts table, it causes a problem since the record only satisfies one of the constraints.

so is it possible to have a column in an oracle database that references two seperate columns but only has to satisfy one of the FK constraints?


btw, you can see the ERD here: http://www.auburn.edu/~shanncb/db/relationships.bmp
Either you create 2 different contact tables for client and contractor.
OR
Create a single table for client and contractor.
OR
When you enter a row in Client table, enter a "false row" in contractor table and vice-versa. To identify a false row, keep some flagging. (Else as you have already specified based on ID)

Hope this helps
Nov 29 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Nick Heppleston | last post by:
I have a concatenation problem and I was wondering if somebody might be able to offer some help :-) I have the following table structure holding product long descriptions: Part...
6
by: JackT | last post by:
I want to get a column count several times in one query using different filters but can't work out how to do it - can anyone point me in the right direction? For example, how would combine these...
2
by: Robert | last post by:
Hi All, I'm trying to solve this for a few days now and I just can't figure it out... I have three tables set up, I'll simplify them for this question: Table 1: HOTELS Columns: HOTEL_ID,...
26
by: pb648174 | last post by:
I have a table called BidItem which has another table called BidAddendum related to it by foreign key. I have another table called BidFolder which is related to both BidItem and BidAddendum, based...
11
by: FreeToGolfAndSki | last post by:
Hi, I have an Orders Table that has Employee1 and Employee2 (one is the sales rep the other is the telemarketing rep) Both of these fields need to cascade update against the Employees table. I...
0
by: ckiraly | last post by:
Greetings everyone - I am new to MSSQL 2005, and have started a database design project for my company. The issue I have is in a specific instance of foreign key creation. Here is the whole...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.