且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

具有可变字段数的数据库结构设计

更新时间:2023-02-08 17:16:27

具有一个将n:1链接到item_type表的属性表,如下所示:

Have a property table which is linked n:1 to the item_type table like this:

TABLE item_type (
  item_type_id INT,
  ... )

TABLE properties (
  property_id INT, -- primary key
  item_type_id INT, -- foreign key for item_type
  key NVARCHAR(max), -- adjust type to your needs
  value NVARCHAR(max) )

因此每个item_type可以具有0:n属性.

So each item_type can have 0:n properties.