SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru pinch's Avatar
    Join Date
    Mar 2005
    Posts
    686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    3-Tier Command Tree Structure

    In my application I have to maintain a 3-tier 'command structure' for a branch of the military. At the top-level are 'Commands', under these are 'Departments', and under these are 'Sections'. Some Departments have Sections, some do not. 'Personnel' can reside at either the Department or Section level.

    My first stab at a DB design is as follows:

    Commands
    CommandID int PK
    Command varchar(64)

    Departments
    DepartmentID int PK
    Department varchar(64)

    Sections
    SectionID int PK
    Section varchar(64)

    CommandStructure
    NodeID int PK
    CommandID int
    DepartmentID int
    SectionID int
    Description varchar(128)

    Personnel
    PersonnelID PK
    NodeID int

    Is this a proper design?

    Thanks in advance.

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i would do it like this:

    nodes
    id int PK
    name varchar(64)
    type varchar(64) (will be command, department, or section)
    parent int NULL
    Check out our new Industry News forum!
    Keep up-to-date with the latest SP news in the Community Crier

    I edit the SitePoint Podcast


Bookmarks

Posting Permissions

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