在下面的表结构: Fruits
(
fruit_id,
fruitName
)
Vegetables
(
vegetable_id,
vegetableName
)
favoriteFoods
(
food_id,
foodName,
type_id (References either a fruit or a
我有两个类: public class Code
{
public virtual Guid CodeId { get; set; }
public virtual string CodeValue { get; set; }
public virtual Guid EntryId { get; set; }
}
public class Entry
{
我试图在表中建模树关系。例如,有“类别”,类别本身可以在父类别中。 我的模式是: id int PRIMARY KEY,
parent_id int,
name
我的问题是,我应该标记PARENT_ID列作为外键?外来意味着“外部”而不是自我参照。为此目的是否有不同类型的钥匙? 我的问题类似于: Self-referencing constraint in MS SQL,但我问了一个不同的