Reputation: 1392
These are my requirements:
So far i have come up with this DB Design
CategoryGroups Table
GroupID
| CatID[References Category(CatID)]
| GroupName
CategoryAttributes Table
AttributeID
| AttributeName
| GroupID[References CategoryGroups(GroupID)]
| AttributeValue
So do you guys think this is a neat design?? Any suggestions??
Upvotes: 0
Views: 289
Reputation: 427
Is there any reason not to have four tables for your four concepts?:
Category: id, <category stuff>
Group: id, category_id, <group stuff>
Attribute: id, group_id, <attribute stuff>
Value: id, attribute_id, <value stuff>
Primary keys are the id columns.
Foreign keys are as named (i.e. attribute_id is a foreign key to Attribute.id)
Upvotes: 0
Reputation: 4926
Apart from naming your second table GroupAttributes
, because it doesn't know anything about Category, this is one, most used, good approach. You have multiple 1:N (one to many) relationships, and you're referencing tables in the right way.
Upvotes: 1