Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Question: Entities With Common Attributes
It seems to me that name is name ... whether a business name or a person name. And phone number is certainly phone number. So you could create a customers table with the common fields and then use a secondary table for each type of entity containing those items specific to that customer type. Another way to do this would be as follows:
CUSTOMERS TABLE
customer_no
customer_name
entity_type (B or I)
phone_no
CUSTOMER_ATTRIBUTES TABLE
customer_no
attribute_type (for example "FAX", or DRIVERS LICENSE")
attribute_value
Which would have the additional advantage of allowing you to create new attributes on-the-fly.
No doubt others, better grounded in architecture, will have better ideas.
Daniel A. Morgan
SQL-er wrote:
> Thanks in advance for any suggestions offered:
>
> All right, I *thought* I understood database modelling and SQL, until the
> following arose:
>
> What is the "accepted way" of handling something like this ?
>
> A database model for a company sales obviously contains an entity "customer"
>
> But, in this case, there are 2 types of customer - "businesses" and
> "individuals"
> Different attributes are recorded for each type
>
> eg: something like:
>
> Individual-Customer
> Customer-number
> Name
> Phone-no
> Driving-Licence-number
>
> Business-Customer
> Customer-number
> Business-name
> Business-type
> phone-no
> fax-no
>
> So, the customer-number is the only attribute common to both types of
> customer
> But, I don't see how that ought to be handled
>
> I'm probably missing something very obvious here...
> Could someone give me a hint as to what it is ?
>
> novice SQL-er ( still learning )
Received on Wed Apr 04 2001 - 01:03:24 CDT