Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Normalization from an excel form Expand / Collapse
Author
Message
Posted Sunday, October 14, 2012 5:17 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, October 18, 2012 3:48 AM
Points: 3, Visits: 23
Hey guys, I have some problems with normalizing the data.
Could you take a look at this file

http://speedy.sh/YtK9G/example.xlsx

These is the list of attributes: week site day timeSlot employee role sick totalHrs
Week and site will be a compound key.

A lot of things confuses me here so I'd really appreciate your help.
Thanks in advance :)
Post #1372547
Posted Monday, October 15, 2012 12:44 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, November 18, 2014 6:44 PM
Points: 1,280, Visits: 1,760
If you take a look at the Microsoft example database called AdventureWorks, it has a very similar structure to what you're looking for:
http://msdn.microsoft.com/en-us/library/ms124438%28v=sql.100%29.aspx

Specifically look at the HumanResources.Shift, HumanResources.Employee

You need separate tables for Site (ID name location purpose), Employee (ID name occupation), Day (ID, Name), EmploymentRole (ID, rolename), TimeSlot(ID Start and end times - no dates), Sick(Maps Timeslot & Employee), ShiftRecord (Maps EmpID, DayID, TimeSlotID, RoleID)
Then use excel to link to these tables with dropdown selection list (MyList function).

Post #1372570
Posted Monday, October 15, 2012 3:50 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, October 18, 2012 3:48 AM
Points: 3, Visits: 23
Thanks.
That thing exactly confuses me, because trying to do top - down approach for this case I know I will need a separate table for almost every attribute here.
But I'm not really quite sure how to go about bottom-up approach. I know the rules of normalization, and that should be enough, but still...

UNF: week site day timeSlot* employee* role* sick* totalHrs*

Let me try do the 1NF (I should break out repeated groups to form new group and include original key as a foreign key), so:

1NF:
1) week site day (should I put the day attribute here? the data itself does not repeat in the form)
2) employee week site timeSlot role sick totalHrs

What do you think about it? Is that ok?
Post #1372634
Posted Monday, October 15, 2012 9:40 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, November 18, 2014 6:44 PM
Points: 1,280, Visits: 1,760
Oh I see, OK, I don't think 1 is correct, with {day} there you'll have non unique week site keys, or am I jumping past 1nf..

IMO, I think it should be
week site day timeSlot* employee*
Week day employee sick
Employee week totalhours

Its getting a little into 2nf I think though.. but you can still break out further since employee does not depend on week site day etc.. so possibly OK.
Post #1372783
Posted Monday, October 15, 2012 10:40 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, October 18, 2012 3:48 AM
Points: 3, Visits: 23
Thanks again for the response.
I forgot to mention that I have to get this thing all the way to 3NF.

There's no employee role in your suggestion.

I've attempted to go a step further and get it to 2NF and I got:

week
site
day
employee role
timeSlot
site week day employee timeSlot
employee week totalHours

Bold attributes are assumed to be IDs.
Underlined ones are foreign keys.

As you see I'm still confused. The set of attributes is so varied that I'm tempted to jump in and split them up immediately.

Unfortunately I have to prepare the formal solution and what should be added in 1NF is supposed to be in 1NF, what in 2NF in 2NF. Else I'll lose some points while being graded :)

Thank you again for your time :)
Post #1372824
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse