Re: How could I model this relationship?
Date: Wed, 26 Jun 2002 10:39:27 +0100
Message-ID: <1025084356.28352.0.nnrp-13.c2de0ffb_at_news.demon.co.uk>
"Pavel Filatov" <pavel_at_ifjf.uib.no> wrote in message
news:20020625150631.30c89fbb.pavel_at_ifjf.uib.no...
> On Tue, 25 Jun 2002 13:18:00 +0100
> "Stu" <smcgouga_at__at_yaho.com_> wrote:
>
> > Hi,
> >
> > I have a relationship: many companies have many customers. but a
customer
> > is also a company! So how would I model this in a relational db?
> >
> > Could I just have the company with a relationship going straight back
into
> > company (EER)? If so How do you transfer this to tables?
> >
> > cheers
> > stu
> >
> >
> Yes, company entity can make relationship to the company entity.
> If customer is always a company then it can be represented:
> table companies (id_company)
> table customers (id_company, id_customer), primary key
(id_company,id_customer)
> foreign key from customers (id_company) to companies (id_company)
> foreign key from customers (id_customer) to companies (id_company)
>
> Regards,
> Pavel
Received on Wed Jun 26 2002 - 11:39:27 CEST
