The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Databases
> MySQL Help
|
Group "Similar" Items
Discuss Group "Similar" Items in the MySQL Help forum on Dev Shed. Group "Similar" Items MySQL Help forum discussing administration, SQL syntax, and other MySQL-related topics. MySQL is an open-source relational database management system (RDBMS).
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 28th, 2012, 11:48 AM
|
 |
Contributing User
|
|
Join Date: Nov 2012
Posts: 98
Time spent in forums: 1 Day 2 h 20 m 38 sec
Reputation Power: 1
|
|
|
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, 12:44 PM
|
 |
Lost in code
|
|
|
|
|
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, 01:14 PM
|
 |
SQL Consultant
|
|
Join Date: Feb 2003
Location: Toronto Canada
|
|
|
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, 12:20 PM
|
 |
Contributing User
|
|
Join Date: Nov 2012
Posts: 98
Time spent in forums: 1 Day 2 h 20 m 38 sec
Reputation Power: 1
|
|
Quote: | Originally Posted by r937 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) |
This is all excellent information. Thank you both;
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|