4 ms·
Ask HN: Data Structure Question
I have a database of products and need to map their relationships. I’m looking for suggestions on the best approach, thanks!
Each product has multiple types of relationship to other products such as by size (100mL, 500mL, 1L etc), or by colour, or by flavour (e.g. salt & vinegar or original crisps), or simply by being the “same” product but by competing manufacturers.
If each product row contains a list of related products as a field, that could work, but wouldn’t it be better to map out the tree, graph (or whichever data structure) of all products’ relationships and when a product is queried search the data structure and return the list for that product?
- bradley13 3y agoHomework question? Even if it's not, you need a much better problem description, before anyone could help you. I have the feeling you don't really understand the problem yourself.
- jpmarionata 3y agoUse one of the BI tools. They'll do this mapping for you as part of their ETL
- ssss11 3y agoThanks for this suggestion
- pestatije 3y agothe relationships you mention are just product properties...you relate different products that have the same property with the use of a query
- ssss11 3y agoThank you for the constructive comment. I agree, I think I was over-complicating it in my head.