Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Shift Schedule database design

Posted on 2011-09-27
8
Medium Priority
?
2,304 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
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 

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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

721 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