ProductSubCategory that belongs to multiple ProductCategory

2 views
Skip to first unread message

Deep Kunnath

unread,
Jun 23, 2012, 10:13:44 PM6/23/12
to msbi-t...@googlegroups.com
Hello all,
I am running into an issue regarding the relationships between a few of my tables. I have a 'Products' table that contains values which link to 2 other tables, 'ProductCategory' and 'ProductSubCategory.'
For example:

ProductKey | ProductName | ProductCategory | ProductSubCategory | Price
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
1                | Computer        |    2                    |       1                       | 1000.00
2                | White Board    |    1                    |       1                       | 1000.00

The ProductCategory and ProductSubCategory columns link as foreign keys to the primary keys in their respective ProductCategory table and ProductSubCategory table.
The ProductCategory table has 2 columns (ProductCategoryKey and ProductCategoryName) and the ProductSubCategory table has 2 columns (ProductSubCategoryKey and ProductSubCategoryName). The issue is that I would like to add a column to the ProductSubCategory table that links it to the ProductCategory it belongs to. The problem is that, since one ProductSubCategory can belong to multiple ProductCategory keys, I cannot insert records in the ProductSubCategory table because it would create a record that reuses the ProductSubCategoryKey. Is there anything I can do as a workaround to establish these relationships?

Sridar K

unread,
Jun 25, 2012, 5:11:24 AM6/25/12
to msbi-t...@googlegroups.com
Deepraj,
 
1st - Product Table (pkey, pname,pckey, psckey,price)..
2nd. PC table (pckey, pcname)
3rd  PSC table (psckey, pscname)
 
Relationship --
Product --> PC & PSC through pckey &psckey
 
you have not maintained any relationship between PC and PSC table..

--
You received this message because you are subscribed to the Google Groups "MSBI-Training" group.
To unsubscribe from this group, send email to msbi-trainin...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Thanks & Regards,

Sridar Krishnamoorthy

 +91  95354 88000

Reply all
Reply to author
Forward
0 new messages