Setting up a category taxonomy with proper relations

Hi all,

I’m attempting to setup a 2 level taxonomy for services being displayed within my app with a table for each level:

Category: Home improvement
Subcategory: Flooring

I want to make sure I’m properly associating the taxonomy to the actual service pro.
Ex:
Contractor A < Flooring < Home Improvement

I’m a bit lost on the proper way of relating the service pro to the taxonomy given that there will be many other pros using the same tags.

Should this be just a simple many to many relation?

Depends on how your data is set up, but if you have rows with both a category and a subcategory, you can use a template column to join the two together and then use that for a relation to your pros.

Thank you for the quick response Jeff!

I split category and subcategory into two separate tables as I eventually want to add additional tags to the subcategory for navigation and discovery purposes. So maybe I need three tables?

In my example I would have “…wood flooring, tile, etc.”

What I’m not certain of is which table to relate it to since there’s a hierarchy to the taxonomy.

So do I relate to the lowest level and then lookup my way to the top?

Thank you for your help!

The way I would probably do it is to have a single column Category table with just a list of categories.

Home Improvement

Then have a subcategory table that lists subcategory in one column, as well as it’s associated category in another column.

Home Improvement | Flooring

I’m assuming you have a third Pros table that has a category column and a subcategory column along with the pro name

Home Improvement | Flooring | Contractor A

In the Category table you can create a relation linking the category name to the category name in the Subcategory table.

In both the Subcategory table and the Pro tables, you can create a template column that joins the Category and Subcategory columns together to end up with something like this.

Home Improvement-Flooring

Using the template column in the Subcategory table, you can create a relation linking the template column to the template column in the Pros table.

If I’m way off, then you’ll need to provide more details and screenshots describing your data structure and what exactly you are trying to do.

2 Likes

This is great help, thank you Jeff!

I like the use of the template columns, I’ve been struggling to figure out how to display the association between Cat > Subcat so this is super helpful.

Thank you!!!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.