Thursday, March 29, 2012

Ecommerce Database Design

First, is there a forum here for advanced database design that I'm missing?

I have an ecommerce project I'm working on for which I have to develop a database that will house many products under many categories with unlimited subcategories/levels. For example:

baseball
baseball \ weightlifting
baseball \ weightlifting \ upper body
baseball \ weightlifting \ lower body \ ...

The levels of subcategories must be completely scalable, as the administrator wants to be able to add and subtract at will. Further, there is the idea that some subcategories will transfer across other categories (ex: weightlifting would be a subcategory of multiple sports).

In previous database designs I'vesimply have a category table and maybe a subcategory table; obviously that won't work here, as the number of levels of categories is unknown.

Does anybody have any suggestions, examples, recommended books, forums, etc. to point me in the right direction?

Any help would be greatly appreciated.

BrianOk, Brian... I have designed simmilar type of the databases... the most important thing U should remember is that U deal with relational database instead of treewise... so U must represent the data as a couple of relations (in other words, tables) and link them in Ur queries.
So... for example... place all the categories U have into the table Categories (CatID, Name) and create the table... Relations (RelID, CatID, ParentCatID). So... the Categories should contain the data:

CatID | Name
____________
1 | baseball
2 | weightlifting
3 | upper body
4 | lower body

And the Relations would be:

RelID | CatID | ParentCatID
________________________
1 | 1 | 0 -- that means: "no parent category".
2 | 2 | 1
3 | 3 | 2
4 | 4 | 2

and so on...|||Thanks very much for the suggestion.

I was thinking about having the parentID in the category table. For example:

CatID | ParentID | CatName
-----------
1 0 Baseball
2 1 Weightlifting

...

Is there some advantage to having a separate table for the relations that I'm missing?|||oh... U can for shure ... even to say there is redundant data in my case... yes. If wonna discuss anything more... in more rapid mode... here u r : ICQ# 303978464.

No comments:

Post a Comment