I've got the following tables: Customers and Products. I want to
create an intersection table called Customer_Products to house the
specific products that each customer gets. In this example, the
customers are grocery stores, and the products are bakery items. Not
all Customers (stores) will sell the same products, but most will share
the majority of products for their selling.
Do I take the minimal data approach and create an exception table,
listing the products that the specific Customer does NOT carry (option
1), or do I store each valid product the customer carries (option 2)?
So for option 1, to get the products for a given customer would be this
SQL (EXCLUSION approach):
select * from products where ipk not in (select iproductid from
customers_products where icustid = ?viCust)
Or the sql for option 2 (INCLUSION approach):
select * from products where ipk in (select iproductid from
customers_products where icustid = ?viCust)
I figured that if most of the time, the majority of products are
available to a customer, it'd be better to choose option 1, because it'd
be less intensive data operations.
Your comments appreciated...tia!
--Michael
--
Michael J. Babcock, MCP
MB Software Solutions, LLC
http://mbsoftwaresolutions.com
http://fabmate.com
"Work smarter, not harder, with MBSS custom software solutions!"
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.