.net - SQL Azure database design issue -
i building database store categories, , every category has multiple sub-categories.
i trying find best way design cant think of except creating 1 table each category, feels bit messy seeing how there @ least 50 categories. there way can create "category"-table , somehow have column called "subcategories" lists multiple strings? if so, how split these subcategories can retrieve them without problem application?
your comment solution people go with.
create table categories
, , second table subcategories
.
categories
have unique primary key categoryid
(think identity
).
subcategories
have primary key subcategoryid
, foreign key categoryid
now lets have category in code , want of subcategories:
declare @categoryid bigint = 23 select s.subcategoryid, s.categoryid, s.name subcategories s s.categoryid = @categoryid
of course if using database access technology entity framework won't writing kind of sql ef take care of you.
Comments
Post a Comment