Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for help laying out a database that stores information similar to a class definition and then also instances of those 'classes' (but not referring to an ORD). The specific example is that there are types of electronic modules (AbstractModule) that have connectors on them (AbstractConnector) and a given type of connector will have some number of contacts in it (AbstractContact). This is straightforword, AbstractContact has a foreign key to AbstractConnector which has a foreign key to AbstractModule. With those tables filled out and linked I have a set of possible electronic modules defined.

But how do I now store an instance of an abstract module? The additional information is primarily just the connections made to each pin of each connector on the module. Is it possible to enforce reasonable constraints in the database or is this a case where it must be enforced by the application? If we just look at the modules and connectors I would expect

Connector FK to its Module

Connector FK to its AbstractConnector

Module FK to its AbstractModule

My concern is that there are two paths from Connector to AbstractModule (Connector>AbstractConnector>AbstractModule and Connector>Module>AbstractModule) and I don't see how (other than application code) to enforce that they both end up at the same module. If the answer is just that, use the application, that's fine. I just want to be sure I'm not overlooking something or horribly mis-designing the database.

Note that it may well not be necessary to have both Connector and AbstractConnector, but either way I believe the branching and merging foreign key path will still exist.

Thanks for any comments, links, pointers... I can't even figure out how to tag this.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.