If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > database design helping

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-23-11, 12:47
gandalf75 gandalf75 is offline
Registered User
 
Join Date: Mar 2011
Location: italy
Posts: 1
database design helping

Hi all, this my first post here, I have so many categories with three sub-levels, what strategy do you recommend for the structure? I attach a gif to give a better idea, thanks



P.S.
.... maybe for my case since many of the categories defined with 3 sub-levels each formed by a maximum of six elements, I adopt the technique Adjacency List Model
Attached Thumbnails
database design helping-db_nestedset.gif  

Last edited by gandalf75; 03-23-11 at 13:04.
Reply With Quote
  #2 (permalink)  
Old 03-23-11, 15:32
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
I'd use a self referencing FK.
eg

table categories
ID
Description
ParentID references ID in the same table

see Ask the Expert

or do a google on SQL categor r937
Google
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 03-23-11, 16:36
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,535
healdem, thanks for the props

i think this is what you had in mind... Categories and Subcategories

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 03-23-11, 17:08
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,262
Quote:
Originally Posted by r937 View Post
healdem, thanks for the props

i think this is what you had in mind... Categories and Subcategories

I knew it was out there, somewhere.. but could I find it....
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On