Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 12th, 2004, 01:59 PM
hlab hlab is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 26 hlab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 54 m 15 sec
Reputation Power: 0
Oracle tables design

Hi everyone,
I'm new to oracle and I would like some help designing a table(s).
My database contains 6 tables 2 of them are the ones that I want to establish some kind of relatonship between them.
Product Table:
Prod_ID (PK)
Prod_name Varchar2(30)

Revinfo table:
Rev_ID (PK)
Rev_Name varchar2(30)
The 3th table is the one that connect the two tables

Rev table:
Rev_ID (PK)
Prod_ID (INT)

The problem is that each rev_ID handles one or more Prod_ID
and vise-versa,one PROD_ID can have one or more Rev_ID.
How can I create this table that handles on to many relationship both ways.

Thanks in advance

Reply With Quote
  #2  
Old October 13th, 2004, 08:36 AM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 6
Rev table:
Rev_ID (PK)
Prod_ID (INT)

How can I create this table that handles on to many relationship both ways.??

Make the foreign key instead of primary key, as shown below

Rev table:
Rev_ID (FK)
Prod_ID (INT)

You can also define the Prod_ID as a foreign key, if required.

Reply With Quote
  #3  
Old October 13th, 2004, 10:44 AM
hlab hlab is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 26 hlab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 54 m 15 sec
Reputation Power: 0
Oracle table design

Quote:
Originally Posted by shafique
Rev table:
Rev_ID (PK)
Prod_ID (INT)

How can I create this table that handles on to many relationship both ways.??

Make the foreign key instead of primary key, as shown below

Rev table:
Rev_ID (FK)
Prod_ID (INT)

You can also define the Prod_ID as a foreign key, if required.


Thanks Shafique, I'll try that.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Oracle tables design


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT