December 28th, 2012, 12:48 PM
Group "Similar" Items
I am trying to link certain items with other related items. Examples of this would be a shopping cart when you want to checkout an item and it shows you a message "Other items that are similar to this one are:" - This is what I want to do, but don't know if there's a standard logic for linking them? Should I create another column for the product table with keywords? or should I link them by id, or something else?
December 28th, 2012, 01:44 PM
There is not really standard logic for this. Figure out how you want to relate items from a business perspective, then once you have that defined you can build a database structure to support it.
December 28th, 2012, 02:14 PM
right, there's no standard logic for deciding what is "related"
however, the structure to support a product-to-product relationship is pretty simple and supports all kinds of affinities
you have a product table and a separate product relationship table which has exactly two columns, both of them product keys, each of them a foreign key to the product table, and both of them together as the primary key
the nice thing is that a single row relating two products is directional
for instance, when selling a bicycle, you want to suggest a helmet, but when selling a helmet, suggesting a bicycle would be risky (customer might abandon the cart right there in outrage)
December 29th, 2012, 01:20 PM
Originally Posted by r937
This is all excellent information. Thank you both;