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 > Database Server Software > MySQL > Database inheritance - not sure if i'm doing it correctly?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-06-09, 15:39
Theresonly1 Theresonly1 is offline
Registered User
 
Join Date: Nov 2009
Posts: 24
Question Database inheritance - not sure if i'm doing it correctly?

Hello

I have just designed a database with an inheritance relationship. I have supertype as a table on its own. Each subtype would also have a table too.

i need to reference the supertype with the subtype.

supertype table:
- id (PK)
- ..other fields

each subtype table:
- id (PK)
- ..unique sub fields

Should i make subtype id a FK as well as a PK so it can reference its parent supertype? OR should i introduce an additional field that does the referencing like:

subtype table:
- id (PK)
- unique sub fields..
- supertype_id (FK) which references the parent

??

Also - should my subtype PK id be auto-increment?

thanks in advance
Reply With Quote
  #2 (permalink)  
Old 12-12-09, 11:32
Theresonly1 Theresonly1 is offline
Registered User
 
Join Date: Nov 2009
Posts: 24
ah, nevee mind. i think i got it
Reply With Quote
Reply

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