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

Recommended Answers

All 2 Replies

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.