SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Normalization from an excel form


Normalization from an excel form

Author
Message
zesralem_sie
zesralem_sie
SSC Rookie
SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)

Group: General Forum Members
Points: 37 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 Smile
Andrew G
Andrew G
SSCarpal Tunnel
SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)

Group: General Forum Members
Points: 4727 Visits: 2298
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).
zesralem_sie
zesralem_sie
SSC Rookie
SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)

Group: General Forum Members
Points: 37 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?
Andrew G
Andrew G
SSCarpal Tunnel
SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)

Group: General Forum Members
Points: 4727 Visits: 2298
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.
zesralem_sie
zesralem_sie
SSC Rookie
SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)

Group: General Forum Members
Points: 37 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 Smile

Thank you again for your time Smile
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search