Re: How could I model this relationship?
Date: Wed, 26 Jun 2002 12:39:20 +0200
Message-ID: <20020626123920.49eafd98.pavel_at_ifjf.uib.no>
On Wed, 26 Jun 2002 10:39:27 +0100
"Stu" <smcgouga_at__at_yaho.com_> wrote:
> Just thinking: What if not every customer was a company. i.e. every
> customer is either a company OR a persons name (persons name is the only
> details we would have.)
>
> cheers
> stu
Is person name always unique?
I know tens John Smith;)
You should use an unique index for customers.
In ER model it can be represented via Class Hierarchy
Customers cover both companies and clients.
In tables:
table customers (id_customer, other attr)
table companies (id_company, other atrr)
table clients (id_client, other attr)
foreing key companies (id_company) references customers (id_customer)
foreing key clients (id_client) references customers (id_customer)
table business (id_company, id_customer)
foreign key business (id_company) references companies (id_company)
foreing key business (id_customer) references customers (id_customer)
Regards,
Pavel
Received on Wed Jun 26 2002 - 12:39:20 CEST