If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Table Design question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-23-07, 14:24
RedNeckGeek RedNeckGeek is offline
Village Idiot
 
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
Reply With Quote
  #2 (permalink)  
Old 05-23-07, 16:49
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
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"
Reply With Quote
  #3 (permalink)  
Old 05-24-07, 07:09
RedNeckGeek RedNeckGeek is offline
Village Idiot
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On