0

hi. Im afiya . i have a company's product catalogue . Im asked to represent the products in treeview control of VS2008 . Please can any one tell me how the database must be designed so that i can add a product as parent node or child node on the basis of products and its type.
the products are listed as
product code|| product name ||product description || price
abc1001 ABCD its description
1.xyz its description 23000
i ss its description 67000
as you can see the main product does not have price defined ..
so it is really becoming hard for me to design a database..
There are many products which dont even have any sub types and many of them have so many sub type .. so please tell me how to design a database for such product listing..
please its urgent...
P.S -can u refer me any book for database design

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by ithelp
0

product_name varchar(50),
product_type char(1),//C for category and I for ITEM
price numeric(8,2)


product_level
parent_id numeric(5),
child_id numeric(5),
level numeric(2)

example of PRODUCT_MASTER TABLE
PRODUCT_ID, PRODUCT_NAME, PRODUCT_TYPE, PRICE
0 , 'PRODUCTS', 'C',NULL //ROOT NODE
1, 'CATE 1','C', NULL // CATEGORY 1
2, 'CATE 2' ,'C', NULL // CATEOGORY 2
3, 'CATE 11', 'C', NULL // SUB CATEGORY UNDER 1
4, 'ITEM 11-1','I', 50.00// ITEM UNDER SUB CATEOGRY 11
5, 'ITEM 2-1','I', 150.00 // DIRCT ITEM UNDER CATEGORY 2

WE CAN GO TO ANY LEVEL OF CATEGORIZATION

example of PRODUCT_LEVEL // THIS IS TO KEEP TRACK OF ALL
GRAND PARENT OF ITEM,
AT WHICH LEVEL CHILD EXISTS, INCLUDING SELF RECORD WITH LEVEL 0. USING JOIN WE CAN GET OTHER INFORMATION

CHILD_ID, PARENT_ID, LEVEL
0, 0, 0

1, 1, 0
1, 0, 1

2, 2, 0
2, 0, 1

3,3,0
3,1,1
3,0,2

4,4,0
4,3,1
4,1,2
4,0,3

5,5,0
5,2,1
5,0,2


ALL DATA INSERTION NEED TO TAKEN CARE AT FRONT END. I have implemented this design successfully.

0

It does not matter whether price is defined or not , add it later , if the price of a product is not available , just do not show that product to the customer.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.