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 > Table Design Assistance

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-14-11, 15:44
jsladek jsladek is offline
Registered User
 
Join Date: Aug 2011
Posts: 2
Table Design Assistance

I'm hoping this will be an easy one. I'm planning on building an application that tracks the physical location of objects. So far, I'm thinking that i can create a table called containers and allow the user to create the containers. Then associate the object with that container. Where it is getting a little tricky for me is that some containers will be inside other containers. I'm considering everything a container. A building, floor, room, cabinet, draw, etc. I want my user to be able to create all these elements as they see fit. The first container they will create will be the building. The user can then create sub containers if they are needed. In some instances the object might be stored in building_a/first_floor/room_b/cabinet_c/drawer_3/slot_2 (6 containers). In other cases it might just be building_a/basement/bin_v (3 containers). Only the top level container will be linked to an address table. All sub containers would be assumed to be at the same location that it's parent container is in so I should be able to write sql to get that info. I made a quickie erd to try and show what I'm thinking (please ignore the naming).
Does this seem to be a good approach?
Should I Create a separate table for the buildings?
Any input would be greatly appreciated.

Thanks,
John
Attached Thumbnails
Table Design Assistance-object_draft.png  
Reply With Quote
  #2 (permalink)  
Old 08-17-11, 06:05
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
The model looks OK to me. You will want to add a constraint that only top-level containers can be associated with an address.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 08-18-11, 19:23
jsladek jsladek is offline
Registered User
 
Join Date: Aug 2011
Posts: 2
Thanks for the feedback Tony, I appreciate it.

-John
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