Results 1 to 8 of 8
  1. #1
    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 13:14.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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... ?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    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"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    We had a short discussion on hierarchies a while back (if that's the issue).

  5. #5
    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 13:23.

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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!!!
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    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.

  8. #8
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    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"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •