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 > Person hierarchy

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-24-05, 10:46
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
Person hierarchy

Just thought I'd run this by people here as a sanity check.

I have a system where we have a table PERSON that contains one entry per person. There is a PersonID column that is the primary key.

A person can be a student, a person can be an instructor. Or both. (And in the future that list will expand)

I decided to tackle this by creating two tables - STUDENT_DETAILS and INSTRUCTOR_DETAILS - which use PersonID as their primary key column.

I then created two views - STUDENT and INSTRUCTOR - that retrieve all fields (including the PERSON fields). So people can write queries like "Give me all students" without having to do the joins explicitly with the PERSON table.

Any other recommendations/criticism? I loosely based this on DB2's Object-Relational extensions, they allow typed tables and inheritance that mimic the Object-Oriented world.

jono
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #2 (permalink)  
Old 10-24-05, 11:07
rajiravi rajiravi is offline
Registered User
 
Join Date: Apr 2004
Location: Toronto, Canada
Posts: 249
That seems like a pretty good way of doing it.

Ravi
Reply With Quote
  #3 (permalink)  
Old 10-24-05, 16:59
urquel urquel is offline
Registered User
 
Join Date: Aug 2004
Posts: 330
Sounds like you stumbled upon a subtype.
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