Solved

Shift Schedule database design

Posted on 2011-09-27
8
2,185 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 96

Expert Comment

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

Author Comment

by:ThinkerB
ID: 36717505
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
ID: 36717893
Do you need to store the dates for each user?  Do you need to generate a work schedule for a specified period?
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

Author Comment

by:ThinkerB
ID: 36718641
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 36718692
Something like this?

User
         UserID
         FirstName
         LastName        

UserShift
         UserShiftID
         UserID
         ShiftID

Shift
         StartDate
         StartTime
         EndTime
         DayInterval
0
 
LVL 28

Expert Comment

by:Ryan McCauley
ID: 36718764
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
ID: 36933033
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
ID: 36933711
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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
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…

632 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