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 > General > Database Concepts & Design > Is this good practice?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-05-08, 11:54
kreeves kreeves is offline
Registered User
 
Join Date: Mar 2008
Posts: 5
Is this good practice?

I will preface this post with the fact that, I am familiar with a very base level of database design.

I am working on a database currently for an inventory system that will essentially inventory any and everything (from furniture, to *potentially* books).

Before I present the entire database, I'd like to present a problem to you all. I've got a table named "category" that consists of the fields ("id", "name","id_sub","master_id").

We have no idea how deep that the creation of subcategories is going to go, so this is the only solution I've been able to come up with.


It seems as though it's common practice to post the ERD here along with the OP. I'm working on that now for you all, but am eager to get this post up for you all to begin discussion.

(For the record, this design was done by someone else and I'm recreating it in DBDesigner and *attempting* to build upon it)

Of course, this post makes sense to me, but you all might be completely lost, and if so, I apologize ahead of time and will work on completing the ERD.

Last edited by kreeves; 03-05-08 at 12:14.
Reply With Quote
  #2 (permalink)  
Old 03-05-08, 11:58
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by kreeves
Before I present the entire database, I'd like to present a problem to you all.
and that problem is... ?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 03-05-08, 12:06
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
Well, before we get into the specifics of your design, I'd like to present you with this solution to your problem:
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
  #4 (permalink)  
Old 03-05-08, 12:14
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
We had a short discussion on hierarchies a while back (if that's the issue).
Reply With Quote
  #5 (permalink)  
Old 03-05-08, 12:17
kreeves kreeves is offline
Registered User
 
Join Date: Mar 2008
Posts: 5
I've bold typed the portion that is in question.

Is there a better way to manage the categories... This seems awful dirty to me, but I cannot come up with a better solution.

Thank you for your quick replies.

EDIT: Reading mike_bike_kite's topic... it appears to have some very good discussion on the topic. Thank you.

Last edited by kreeves; 03-05-08 at 12:23.
Reply With Quote
  #6 (permalink)  
Old 03-05-08, 12:34
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by kreeves
I've bold typed the portion that is in question.
so you have an adjacency model table, and you don't know how many levels you have

that still has not elucidated what the problem is

that fact that there are many levels isn't a problem, it's a feature!!!
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 03-05-08, 14:01
kreeves kreeves is offline
Registered User
 
Join Date: Mar 2008
Posts: 5
Quote:
Originally Posted by r937
so you have an adjacency model table, and you don't know how many levels you have

that still has not elucidated what the problem is

that fact that there are many levels isn't a problem, it's a feature!!!
This is all I needed to know. I was unfamiliar with the terminology "adjacency model". Now I've got something to work off of and do some more research on.

Thank you.
Reply With Quote
  #8 (permalink)  
Old 03-05-08, 16:59
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
No problem. Stop back in the forums if you need assistance writing code around the schema.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
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