Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941

    Table Design question

    I'm working on a production recording database for our plant.
    One of the metrics I need to measure is downtime. Downtime
    can fall into 3 different buckets:
    1) Unplanned - Related to the production run
    2) Unplanned - Not related to the production run
    3) Planned - Not related to the production run

    Unplanned could be a mechanical breakdown, while planned would be
    something like a safety meeting.

    Production runs are supplied a unique run number, so some of my downtime will be assigned to a run number, and some of it won't.
    I'm thinking of a table like this:

    DownTime
    ========
    Date
    Shift
    ReasonCode
    RunNumber (allow nulls)
    Minutes

    Where date, shift, and reason code would be composite key.
    For some reason I feel like I'm missing something, though. Does anyone
    see a better way to do it?

    Thanks
    Mark
    Inspiration Through Fermentation

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Date/Shift/ReasonCode should not be a primary key, as I would assume downtime could possibly occur twice on a shift for the same reason. I think you just need a timestamp in there instead to complete the key.
    If it's not practically useful, then it's practically useless.

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

  3. #3
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    That's true. I wasn't thinking about that. I think I'll go with a start and stop time instead of total minutes.
    Thanks
    Inspiration Through Fermentation

Posting Permissions

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