schema: best way to implement "company" address info

  • Hiya,

     

    I’m trying to get a schema where I can use the same table for the addresses within a specific company, regardless of whether it is a branch or headOffice etc…

     

    It seems like a good idea to treat "headOffice" as a type of branch.

     

    <schema>

    tblCompany

    companyId

    companyName

     

    tblCompanyBranch

    companyId

    branchId

     

    tblBranch

    branchId

    branchName    eg, “Aberdeen

     

    tblBranchType

    branchTypeId

    branchTypeName  eg, “Head Office”

     

    tblCompanyBranchAddress

    branchId

    address1

    address2

    postCode

    phone

    etc

    <\schema>

     

    I suppose I'm looking for a 2nd opinion.

    Is there anyone out there using roughly the same schema?I want to be able to give the user flexibility, and at the same time, keep the schema maintainable.

     

    All comment appreciated

     

    thanks,

           yogi

     

     

     

  • Are you putting rbanchtype in the companybranchaddress table? Also, not sure why branch name is separated out. Are you planning on sharing names among companies? I'd question that idea, but the idea of treating an HQ as a branch is how I'd do it and the type being a lookup is fine as well.

  • Cheers Steve,

     

    I've modified the schema a bit.

    I am trying to store details about different companies.I can see an issue where I could potentially assign a branch to 2 different companies, but I suppose if I have a dropDown list that I can filter the companies with, then I think I should be ok.  

     

    Is this what you meant when you asked:

    <Are you planning on sharing names among companies? I'd question that idea>

     

    thanks,

             yogi

     

    <schema>

    tblCompany

    companyId

    companyName

     

    tblCompanyBranch

    companyId

    branchId

     

    tblBranchType

    branchTypeId

    branchTypeName  eg, “Head Office”

     

    tblCompanyBranchAddress

    branchId

    branchTypeId

    branchName

    address1

    address2

    postCode

    phone

    etc

    <\schema>

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply