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

    normalization problem

    Hello!

    I'm searching for a solution for the following problem. Maybe someone can help me.

    Let's say I have 2 tables.

    table invoice
    id, customer_id, date, prize


    table customer
    id, name, street, zip, city

    The problem is that if I change e.g. the name in the customer table the name is changed in all invoices that are already booked. That must not be. What is the best solution for that case? Should I create the name, street, zip and city columns into the invoice table too although it breaks the rules of normalization?

    Thank's in advance!

    Mad

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by madmax_81 View Post
    Should I create the name, street, zip and city columns into the invoice table too although it breaks the rules of normalization?
    yes you should and no it doesn't
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Using GAAP terms, a bill is a record of a single transaction and an invoice is a document that is periodically issued to summarize one or more bills.

    Both bills and invoices are statement documents, issued at a given point in time. Bills may be cash transactions, in which case there may not even be a customer name, address, etc. If there is information like name, address, etc provided for the bill or invoice then that information might be defaulted from the customer data or it could be provided by another means... In either case, the information used on the bill or invoice ought to be recorded as part of the record of the transaction instead of depending on the client table at any given point in time.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  4. #4
    Join Date
    Nov 2011
    Posts
    2
    Thank you for your answers!

    Mad

Posting Permissions

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