help for database design

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
corecoders
Forum Newbie
Posts: 2
Joined: Tue Feb 16, 2010 9:27 pm

help for database design

Post by corecoders »

Hello friendz,

I have to design a database structure. In the database I need fields for category, subcategory and product, category is the parent for subcategory and the parent of product is subcategory. There will be about 60 categories and 100 subcategories for each category and around 120 products for each subcategory. Which is the perfect way to design this database ? Using separate tables for each of the field ( and connecting through Primary key and foreign key ) or a single table ( with a parent field for connecting the fields .parent of category field will be 0 and the parent of subcategory will be 1 and parent of product will be 2). I want to make this professionally, so please help. Actually the database has too many other tables with thousands of rows but these are the fields that are accessing frequently.

Please provide a solution

Thank you guys :)
pavanesh2009
Forum Commoner
Posts: 30
Joined: Wed Jan 13, 2010 7:24 am

Re: help for database design

Post by pavanesh2009 »

Are you trying to use Joomla!! :)

If not, have a look on its database architecture, hope it will help you !!
corecoders wrote:Hello friendz,

I have to design a database structure. In the database I need fields for category, subcategory and product, category is the parent for subcategory and the parent of product is subcategory. There will be about 60 categories and 100 subcategories for each category and around 120 products for each subcategory. Which is the perfect way to design this database ? Using separate tables for each of the field ( and connecting through Primary key and foreign key ) or a single table ( with a parent field for connecting the fields .parent of category field will be 0 and the parent of subcategory will be 1 and parent of product will be 2). I want to make this professionally, so please help. Actually the database has too many other tables with thousands of rows but these are the fields that are accessing frequently.

Please provide a solution

Thank you guys :)
corecoders
Forum Newbie
Posts: 2
Joined: Tue Feb 16, 2010 9:27 pm

Re: help for database design

Post by corecoders »

No, I am not using Joomla
manojsemwal1
Forum Contributor
Posts: 217
Joined: Mon Jun 29, 2009 4:13 am
Location: India

Re: help for database design

Post by manojsemwal1 »

For That U have to create 3 table like
1-Categorytb, 2-Subcategorytb,3-producttb

in frist table field would be ----CategoryId CategoryName.

Second table-----------------CategoryId,SubcategoryId,SubcategoryName

Third Table-------------------SubcategoryId,ProductId,ProductName.

frist and second table you can make CategoryId As a Primarykey.............and second and third table you can make SubcategoryId as a primarykey...................

Thanks
Post Reply