If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Help with database design

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-01-10, 14:41
danSogaard danSogaard is offline
Registered User
 
Join Date: Mar 2010
Posts: 1
Help with database design

I've 4 tables, ItemCategory, Items, DiamondCategoy and Diamonds.

The user store item details and specify whether or not it has a diamond on, for example:

ItemCategory: Ring
Item: R1
If there is a diamond then:
DiamondCategory: Round
Diamond: D1

So R1 of Ring has D1 of Round

An Item could have no diamonds, for example:

ItemCategory: Ring
Item: R1
DiamondCategory: None
Diamond: None

I can't figure out how to design the relationships. I came up with this solution, correct me if I'm wrong.

ItemCategory:
c_Id >> PK

Items:
p_Id >> PK
c_Id >> FK
d_Id >> FK

Diamonds:
d_Id >> PK
dc_Id >> FK

DiamondCategory:
dc_Id >> PK

Is that correct?.
Reply With Quote
  #2 (permalink)  
Old 03-01-10, 16:07
MarkATrombley MarkATrombley is offline
Registered User
 
Join Date: Jul 2009
Location: Michigan
Posts: 125
A diamond can only be on one ring, but a ring can have multiple diamonds. Instead of having a diamond ID in the Items table put an item ID in the diamond table. Otherwise I think it looks right.
Reply With Quote
Reply

Tags
database, database design

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On