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 > Subtypes and Supertypes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-10-08, 08:50
michael.appleton michael.appleton is offline
Registered User
 
Join Date: May 2008
Posts: 33
Subtypes and Supertypes

I am not sure when is correct to use supertypes for entities. I have a database in which different entities connect to each other (in the real world) via pipelines and it is these connections which cause me to think I should be using a supertype for all these connecting objects.

For example, at the moment there could be a table for houses, water treatment plants, water pumps. All of these connect via Water pipelines, which also is a table. From what I can see there are two options of how to store these connections:

1. That all these pipeline-connectable objects can exist in a supertype table so they each have unique ids compared to each other, and the table is called WaterInfrastructure say. Then a one junction table can hold the ids of connection objects and the pipeline that connects them.

2. Each type of object that can join to a pipeline can have it's own WaterPipelinesObjects (where object would actually be the name of the object) to store all these joins.

The supertype seems like the preferable method, although besides each entity being pipeline connectable, there are not very many attributes in common. I'm worried that perhaps a supertype table called "WaterInfrastructure" is too vague to have as a table.

Any comments, suggestions? Thanks for the help!
Reply With Quote
  #2 (permalink)  
Old 10-10-08, 09:58
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
the supertype is certainly more convenient in terms of administering the foreign keys and reducing proliferation of tables

what might help you decide which way to go is to analyze a few typical queries

what sorts of information are your queries typically going to return?

for example, list the object names and connection date for all objects connected to the elm street pump

how would you do that query with the supertype, and how would you do it with separate object tables?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
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