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 > relationships Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-22-11, 21:44
Zuko Zuko is offline
Registered User
 
Join Date: Mar 2011
Posts: 2
Question relationships Question

Hello dbforum friends..
i d like to pick your brains about something..
Suppose i want to create a database for storing, lets say computer stuff, parts, hardware, peripherals etc....

Which way would be better?

1
------
Create a Basictable with all the common fields (like ProductName, Price,Guarantee....)
and then create multiple other tables with each categorie's specific fields and binding those tables with the Basictable with one-to-one relationships..

2
-------
Create just one table with all possible fields and keep Null values in the fields that are not needed for specific categories..

or maybe a third way.. ?

Thanx in advance..
Reply With Quote
  #2 (permalink)  
Old 03-23-11, 05:52
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
both of the methods you describe are suitable

which one is "better" will depend on several things

- how many shared columns are there in the supertype table
- how many unique columns are there in the subtype tables
- how frequently only the supertype table is queried
- how frequently only specific subtypes are queried
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 03-23-11, 07:31
Zuko Zuko is offline
Registered User
 
Join Date: Mar 2011
Posts: 2
yeah.. or i guess i could combine both ways.. Like keeping the supertype table for the common fields and joinning together some of the subtype tables that have most of their fields in common
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