I have a table structure for categories,
Each category can have many children, but can only be a child of one category.
I am deciding whether I should just add a parent_id
column to the table, or whether I should add a reference table that just has the parent_id
and child_id
and maps them together.
If it is important a category can have no parent, in which case it is a root category.
The most common use cases for this table will be:
Selecting one category
Selecting all categories
Selecting all children of a category
Selecting the parent of a category
Selecting the child tree of a category
As far as I can tell there is no benefit of having a reference table for this setup? can anyone see any reason for using a reference table?