Re: How to represent category, subcategory, product
From: Lennart <Erik.Lennart.Jonsson_at_gmail.com>
Date: 21 Nov 2006 12:43:13 -0800
Message-ID: <1164141792.967797.276000_at_m7g2000cwm.googlegroups.com>
)
Date: 21 Nov 2006 12:43:13 -0800
Message-ID: <1164141792.967797.276000_at_m7g2000cwm.googlegroups.com>
TH wrote:
[...]
>
> But this doesn't seem quite right because it allows the possibility
> that Prod.CatId != Prod.Subcat.CatId.
>
Heres one way of handling this:
create table SubcatTable (
SubcatID ... not null primary key
, SubcatName ... not null , CatID ... not null references Cattable... , unique (SubcatID, CatID)
)
create table ProdTable (
ProdID ...,
ProdName ...,
CatID...,
SubcatID...,
foreign key (SubcatID, CatID)
references SubcatTable (SubcatID, CatID) )
/Lennart
[...] Received on Tue Nov 21 2006 - 21:43:13 CET