I have a lot of products on database, and every single one has a single category asociated, now I want to assign every category parent linked with its current category children. For example, in the case of sunglasses, I would like to associate the "Accesories" categories to it, because the current category of sunglasses is "Eyewear", because is the category child of "Accessories". I could do this with 5 or 10 products, but I have hundreds, so I want to do this by code, my little problem now is I can't identify the table with the category parent-children association.
You can find category parent-children association in table
catalog_category_entity in column
path. It show full category tree path: category ids joined by
At screenshots you can find
Living Room category with id
22. At the first screen tree in admin side. And at the second path in db table.