Re: Inheritance or no inheritance, there is a question - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Inheritance or no inheritance, there is a question
Date
Msg-id 200308182136.39919.josh@agliodbs.com
Whole thread Raw
In response to Inheritance or no inheritance, there is a question  ("Vernon Smith" <vwu98034@lycos.com>)
List 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 Aid Primary Keydetail1detail2

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

Profile Languagesid not null references profile A ( ID )language idprimary 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


pgsql-sql by date:

Previous
From: "Vernon Smith"
Date:
Subject: Inheritance or no inheritance, there is a question
Next
From: Peter Eisentraut
Date:
Subject: Re: Changing data type must recreate all views?