i have a category field. each category has at most one parent.
which is better design?
1)one table: category_parent is Foreign key (related to category_id) and category_id is primary key
category_id | category_parent | category_name
2)two table
table1
catgory_id | category_name
table2
id | category | category_parent
category,category_parent are Foreign key (related to category_id) and category_id is primary key
You say that each node will only have parent. For your requirement, the first option is the better design.
The second option is only really mandated if you need a node to have multiple parents.