Re: Inheritance or no inheritance, there is a question

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: vwu98034(at)lycos(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: Inheritance or no inheritance, there is a question
Date: 2003-08-19 04:36:39
Message-ID: 200308182136.39919.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Vernon,

> What is the best solution for this DB scheme problem?

Have you considered not using inheritance? As a relational-SQL geek myself,
I'm not keen on inheritance -- I feel it mucks up the relational model. Not
everyone agrees with me, of course.

Personally, I'd suggest the following structure:

Profile A
id Primary Key
detail1
detail2

Profile B
id Primary Key references Profile A ( ID )
detail 3
detail 4
detail 5

Profile Languages
id not null references profile A ( ID )
language id
primary key id, language id

etc.

In this way, Profile B is a child table with a 1:0-1 relationship with Profile
A. Multi-value dependancies, like Languages, can be related to either the
people who belong to the B group (and, by implication, the B group) or the
people who belong to the A group only.

Want the B group? SELECT A JOIN B
Want the A group only? SELECT A EXCEPT B

This is the "relational" way to approach the problem.

--
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2003-08-19 07:53:34 Re: Changing data type must recreate all views?
Previous Message Vernon Smith 2003-08-19 03:59:34 Inheritance or no inheritance, there is a question