Solved

Shift Schedule database design

Posted on 2011-09-27
8
1,882 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
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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
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…

776 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