Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Posts
    7

    Question Database design question

    Hi,
    this is a newbie question.
    If a lot of this situation in the database, so I would to know what the good way of doing it.

    Here's a simple example :
    In a table I have a field with a weight when a truck goes in and another when a truck goes out. Now I the program I calculate the net weight (out - in).
    Should the net weight be in the database or no since all the data to found it are available?

    Thanks
    Frank

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171

    Re: Database design question

    Originally posted by bie
    Hi,
    this is a newbie question.
    If a lot of this situation in the database, so I would to know what the good way of doing it.

    Here's a simple example :
    In a table I have a field with a weight when a truck goes in and another when a truck goes out. Now I the program I calculate the net weight (out - in).
    Should the net weight be in the database or no since all the data to found it are available?

    Thanks
    Frank
    No point in storing easily derivable data like this. What you may want is to create a view that includes the derived data:

    create view xxx as
    select ..., weight_in, weight_out, (weight_out-weight_in) as net_weight
    from yyy;

  3. #3
    Join Date
    Jul 2003
    Posts
    7
    Thanks for the fast answer

Posting Permissions

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