Re: Inheritance or no inheritance, there is a question

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Inheritance or no inheritance, there is a question
Дата
Msg-id 200308182136.39919.josh@agliodbs.com
обсуждение исходный текст
Ответ на Inheritance or no inheritance, there is a question  ("Vernon Smith" <vwu98034@lycos.com>)
Список 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 по дате отправления:

Предыдущее
От: "Vernon Smith"
Дата:
Сообщение: Inheritance or no inheritance, there is a question
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Changing data type must recreate all views?