| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: How to represent category, subcategory, product
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 - 14:43:13 CST
![]() |
![]() |