View Single Post
  #1 (permalink)  
Old 08-08-10, 23:57
carlosn carlosn is offline
Registered User
 
Join Date: Aug 2010
Posts: 48
I need a FK to point to different tables - but don't know which a priori

I have a situation that I really don't know how to implement in a database. Please forgive me if I don't use quite the right terminology, I'm a coder but new at DBs.

I have a table of events. In the table there are the columns you might expect: date, creator, event type, brief description.

So far quite trivial. However, now I want to link up each event to a record in a different table that contains more information specific to the event. The problem is that the table to link to is different depending on the event type.

For instance, a hardware malfunction event might link to a table containing information about the hardware, serial number, model, etc; whereas a human error event might link to a table containing procedure number, step number, and so forth.

In C++ I would implement something like this by a pointer to a base class from which the specific event description table classes are derived.

Is there a recommended/proper way of doing this in an RDBMS?

Thanks!
Carlos
Reply With Quote