Re: Database efficiency question
Posted by: Rick James
Date: January 06, 2011 09:11PM

Think of "entities" and "relationships".

A customer is an "entity"; make a table for customers (one row per customer). It would include a unique (PRIMARY KEY) column, say customer_id, plus various bits of data about the customer.

A product is an "entity"; make a table for products.

Then you have a "mapping" or "relationship" between customers and properties. It is probably many-to-many. Make this a table. It would have two imporant columns: customer_id and product_id.

Your queries will often need to do JOINs, maybe even LEFT JOINs. Example: Which product(s), if any, does a given customer have.

Options: ReplyQuote


Subject
Written By
Posted
January 04, 2011 10:46PM
Re: Database efficiency question
January 06, 2011 09:11PM
January 07, 2011 11:18PM
January 08, 2011 12:59AM
January 08, 2011 10:02AM
January 08, 2011 10:38AM
January 08, 2011 11:02AM
January 16, 2011 03:30PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.