Solved

Shift Schedule database design

Posted on 2011-09-27
8
1,769 Views
Last Modified: 2012-05-12
Hi,

I have to design a generic database solution for shift schedule. Some of our clients work in a daily schedule. I mean Mon, Tue, Wed, Thur, Fri from 8 AM to 4 PM and next week from 4 PM to 12 AM. Others have a continental schedule, the employee works 3 days and is off one day.
Does anyone know if I can find a database design pattern for this type of schedule shifts?
Thanks in advance
0
Comment
Question by:ThinkerB
  • 4
  • 3
8 Comments
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
What kind of "generic" database pattern are you looking for?  What kind of data do you need to store?
0
 

Author Comment

by:ThinkerB
Comment Utility
What I am thinking is one table that I should be able to define ShiftTypes and another one that will have shifts per user I mean based on shift type I need to be able to generate records on shift table.
The complex part is that I need to be able to define different types of shifts. Some will have fixed days and variable schedule (morning in one week and afternoon on the next one) and some users will have continental shift (3 days of work and one off).
Generic means the solution has to fit at least those two requirements.
Any ides is appreciated.
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Do you need to store the dates for each user?  Do you need to generate a work schedule for a specified period?
0
 

Author Comment

by:ThinkerB
Comment Utility
Yes I am thinking about generate the dates and store that because I need to assign activities for that day if the user is working on the shift the activity has to occur.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Something like this?

User
         UserID
         FirstName
         LastName        

UserShift
         UserShiftID
         UserID
         ShiftID

Shift
         StartDate
         StartTime
         EndTime
         DayInterval
0
 
LVL 28

Expert Comment

by:Ryan McCauley
Comment Utility
It seems like the scheduled will vary from day to day and week to week, so setting up standard schedules really won't do you any good. Based on what you're describing, I'd just set up a table with a list of the person's particular shifts, along with a notes field where you could fill anything you wanted specific to that particular shift. You'd need some kind of ID for the Employee, a Start/End Datetime (because a shift can span midnight, you'll need the whole datetime for both the start and end). Depending on how you track this data, you may also want to keep not only their scheduled times, but their actual clock in/out times as well.
0
 

Author Comment

by:ThinkerB
Comment Utility
TheLearnedOne,

The issue with this design is that in one week that person will be on the morning shift and the next week he will be in the afternoon and I need to generate the schedule every week.
But I appreciated both ideas.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
Comment Utility
That sounds like you need something more.  How many different combinations of shift types do you have?

If you store each combination in a ShiftType table, then you would just need to know that type, and the StartDate + DayInterval to determine the EndDate.

User
         UserID
         FirstName
         LastName        

UserShift
         UserShiftID
         StartDate
         ShiftTypeId

ShiftType
         ShiftTypeId
         Description
         StartTime
         EndTime
         DayInterval
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now