Quote:
|
Originally Posted by roman2
I thought that each customer WAS a separate entity. Is that wrong? What would be an entity then?
|
Actually, the term "entity" wasn't quite correct; it should have been "entity class" or "entity type". One table per "entity type", e.g. customers. Not 1 table per entity instance, like customer_jones, customer_smith.
Quote:
|
Originally Posted by roman2
I guess not. However, if I created a preference table for each customer upon adding the customer to a customer table, I could add an indicator whether a preference has been expressed, and this would allow me to answer the question you said because I could always count on presence of a preference table for each customer and could refer to it.
|
No, that would tell you only that customer X has expressed
some preference(s). It would not tell you whether customer X has expressed a prreference for product P in particular. To answer my question, you would have to do something like:
Code:
select count(*) from
(select 1 from cust1_prefs where product_code = 'P'
UNION
select 1 from cust2_prefs where product_code = 'P'
...
UNION
select 1 from cust945364_prefs where product_code = 'P'
)
Quote:
|
Originally Posted by roman2
Are there more reasons why this approach isn't good?
|
1) It's an administrative headache: every time you get a new customer, you have to create a new table, create primary/referential constraints on it, grant privileges on it to users, etc.
2) Programs have to use "dynamic SQL" to select from these tables.
And there are no compensating advantages to this approach!