DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: When OrderDetails is Zero

  1. #1
    Join Date
    Jul 2008
    Posts
    8

    When OrderDetails is Zero

    Here is something I've been pining over...

    Let's say you have a database with an Expense and ExpenseDetail table, respectively.

    And, let's say that there are two types of data entry forms:

    Form #1: Expense-level only
    Form #2: Expense-level + ExpenseDetail-level

    For most things (e.g. Groceries, Retail Purchases, etc), you would want to use Form #1 because you likely purchase many "Items" for a given trip to the store (i.e. "Expense").

    But, for some "one-off" things (e.g. Haircut, Shoe Shine, Gas Pump Receipt) you could use Form #2 to streamline data-entry.

    (Why enter an ExpenseDetail for a Haircut when you only ever get one Haircut at a time - unless you have multiple heads!!)


    Now for the question...


    While such a design wouldn't break any Data Modeling Rules - as far as I know - it could cause conflicts when you query data!!

    For instance, if you have a total of 10 purchases, and all 10 have Expense-level data, but only 6 have Detail-level data, then if you queried table ExpenseDetail to find "Total Expenditures" you would get incorrect results.

    (If you queried "Total Purchase Amount" in table Expense, however, you would "catch" all 10 purchases and find "Total Expenditures".)


    Is this a problem?

    Can a person just be mindful of this when you create queries/reports, or is this a "Design Flaw"??



    Just Bob

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    I'm wondering what your "Data Modeling Rules" are... whichever they are it looks like they are not helping you. Your design is not consistent.
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Posting Permissions

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


Click Here to Expand Forum to Full Width