Unix Technical Forum

Categories, subcategories table design

This is a discussion on Categories, subcategories table design within the MySQL forums, part of the Database Server Software category; --> i will have a table for categories something like id parent_id title so that i can put multiple depth ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:27 AM
ars_oguz
 
Posts: n/a
Default Categories, subcategories table design

i will have a table for categories something like

id
parent_id
title

so that i can put multiple depth categories like

aaa >> bbb >> ccc >> ddd

the problem is that when the user clicks aaa the site should show all
products in both aaa and its children and grandchildren like in bbb,
ccc , ddd etc.

i can make this with giving ids that contains parent ids like

aaa
aaabbb
aaabbbccc
aaabbbcccddd

and use "where category_id like 'aaa%' "

but i don't what to use such thing because when i have thousands of
products it will take too much time.

is there any solution for this with integers etc.

Thanks for your help...

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 11:27 AM
Paul Lautman
 
Posts: n/a
Default Re: Categories, subcategories table design

ars_oguz wrote:
> i will have a table for categories something like
>
> id
> parent_id
> title
>
> so that i can put multiple depth categories like
>
> aaa >> bbb >> ccc >> ddd
>
> the problem is that when the user clicks aaa the site should show all
> products in both aaa and its children and grandchildren like in bbb,
> ccc , ddd etc.
>
> i can make this with giving ids that contains parent ids like
>
> aaa
> aaabbb
> aaabbbccc
> aaabbbcccddd
>
> and use "where category_id like 'aaa%' "
>
> but i don't what to use such thing because when i have thousands of
> products it will take too much time.
>
> is there any solution for this with integers etc.
>
> Thanks for your help...


Take a look at these:

http://www.sitepoint.com/article/hie...-data-database
http://dev.mysql.com/tech-resources/...ical-data.html
http://www.intelligententerprise.com...KH0C JUNN2JVN


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 11:27 AM
ars_oguz
 
Posts: n/a
Default Re: Categories, subcategories table design

On Aug 26, 9:35 pm, "Paul Lautman" <paul.laut...@btinternet.com>
wrote:
> ars_oguz wrote:
> > i will have a table for categories something like

>
> > id
> > parent_id
> > title

>
> > so that i can put multiple depth categories like

>
> > aaa >> bbb >> ccc >> ddd

>
> > the problem is that when the user clicks aaa the site should show all
> > products in both aaa and its children and grandchildren like in bbb,
> > ccc , ddd etc.

>
> > i can make this with giving ids that contains parent ids like

>
> > aaa
> > aaabbb
> > aaabbbccc
> > aaabbbcccddd

>
> > and use "where category_id like 'aaa%' "

>
> > but i don't what to use such thing because when i have thousands of
> > products it will take too much time.

>
> > is there any solution for this with integers etc.

>
> > Thanks for your help...

>
> Take a look at these:
>
> http://www.sitepoint.com/article/hie...tml;jsessionid...


Thanks, that is what i have been looking for...

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:54 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com