Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2013
    Posts
    2

    Question I have a loop problem in my database design

    Hello Everyone,

    Attached photo, is just an initial draft of how will database look like.

    I'm facing a loop between relationships and I'm not able to figure out how to get rid of it.

    I'm currently developing an accounting application for my company, and here is a brief of the business requirements:

    - First we have the companies table which lists all companies that are owned by my company

    - For every company we have different types of operations or accounts. So it is a one to many relationship between table companies and tables operation types and account types

    - We have a table listing all accounting operations in all companies. Each operation has one type. Which makes it a one to many relationship between operation types and operations. If I want to know this operation belongs to which company, then I have to check the type of operation and then I can get the company.

    - We have a table listing all accounts in all companies. Each account has one account type. Which makes it a one to many relationship between account types and accounts. If I want to know this account belongs to which company, then I have to check the type of account and then I can get the company.

    - My problem lies in this point, we have a table listing all operation lines. Each line is linked to an operation and an account at the same time (Loop occurring here). A line represents a debit or credit to a certain amount of money. An operation can be a collection of both debit and credit lines at the same time. Moreover, each line must be associated to a certain account

    Thanks for your help.
    Attached Thumbnails Attached Thumbnails image.jpeg  

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    You can create a schema like that, with referential integrity enforced, but you can't implement cascading updates along more than one path.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Nov 2013
    Posts
    2
    Hello Blindman,

    Thanks for your reply.

    Do you think that I can go ahead with this initial design?

    So in this case, it is normal for a loop to occur.

    Of course, I will be enforcing referential integrity and I won't be needing the cascade update option in the mean time.

    Thanks again

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Well, I can't tell you whether that design will satisfy your business requirements, or if it is the best design to use.
    I can only say that it can be implemented and used.
    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
  •