I am trying to model the relation of a tree in a table. For example, there are “categories,” and the categories themselves may be inside the parent category.
My scheme:
id int PRIMARY KEY,
parent_id int,
name
My question is: should I mark parent_id column as foreign key? Foreign ones mean "outside", not self-regulation. Is there any other key for this purpose?
My question is similar to:
Limiting self-regulation in MS SQL , but I ask another question, cascading, not being a problem.
source
share