If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Normalisation Help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-03-07, 09:27
Sylvester Sylvester is offline
Registered User
 
Join Date: Apr 2007
Posts: 9
Red face Normalisation Help

Hi all,

Hope ure all doing better than myslef.

I'm Tim, I'm currently studying web development & am struggling a little with my end of year project particularly the normalisation part of my database design,

Is there anyone out there that would be willing to give me a hand.

If so can u either PM me or send me an email at

Tim.Webster2@Ntlworld.com

Any help u can offer would be much appreciated.

Cheers

Tim
Reply With Quote
  #2 (permalink)  
Old 04-03-07, 09:36
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
you're not going to get a lot of responses asking for private support on a public forum

post your questions here and maybe someone will look at them

note: we won't do your homework for you, but we might answer your questions
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 04-03-07, 09:50
Sylvester Sylvester is offline
Registered User
 
Join Date: Apr 2007
Posts: 9
Fair point!

I see what u mean,

right, the project involves createing a dyanamic website for a ficticious cruise company. The aim of the site is to allow a member of the cruise line admin staff to update the website without the use of a web developer.

Thus far I have three forms which I have normalised,

Crusie date -Contains info about the holidays, cost etc

Staff data -Contains staff username & password

Itinerary data- contains more detailed info about the hols & the schedule

Its really the itinerary data that I'm struggling with,


UNF 1NF 2NF 3NF

itineraryID itineraryID itineraryID itineraryID
heading heading heading heading
description description description description
day image image image
destination
arrive time itineraryID* itineraryID* itineraryID*
depart time day day day
image destination destination destination
arrive arrive arrive
depart depart depart


I'm just not sure if I've normalised this correctly as when I started to gather date it didn't seem right. Above I am left with an Itinerary table n then a Schedule table.

When I gather data for my schedule table this is what i ended up with

itineraryID* day destination arrive depart

1 Tuesday Barbados 8.00pm
1 Wednesday at sea at sea at sea
1 Thursday Trinidad 8.00am 6.00pm
1 Friday Isla Margarita 8.00am 6.00pm
1 Saturday Grenada 8.00am 6.00pm
1 Sunday St Lucia 8.00am 6.00pm
1 Monday St Vincent 8.00am 6.00pm
1 Tuesday Barbados 7.00am
2 Tuesday Barbados 8.00pm
2 Wednesday at sea 8 6
2 Thursday Tortola 8 7
2 Friday St Maarten 8 8
2 Saturday St Kitts 8 8
2 Sunday Antigua 9 6
2 Monday Dominica 8 8
2 Tuesday Barbados 7


Have I done something wrong during normalisation?????? Or does this look ok??

Cheers Muchly

Tim
Reply With Quote
  #4 (permalink)  
Old 04-03-07, 09:51
Sylvester Sylvester is offline
Registered User
 
Join Date: Apr 2007
Posts: 9
an to think i spend all that time spacing it all out nicely!
Reply With Quote
  #5 (permalink)  
Old 04-03-07, 09:59
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Quote:
Originally Posted by Sylvester
an to think i spend all that time spacing it all out nicely!
Try popping it in code quotes - they maintain much of your formatting
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
  #6 (permalink)  
Old 04-03-07, 10:00
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
you will need to go back to basic principles to understand the concept of a primary key

Code:
UNF             1NF             2NF            3NF

itineraryID     itineraryID     itineraryID    itineraryID
heading         heading         heading        heading
description     description     description    description
day             image           image          image
destination   
arrive time     itineraryID*    itineraryID*   itineraryID*
depart time     day             day            day
image           destination     destination    destination
                arrive          arrive         arrive
                depart          depart         depart
Code:
itineraryID*   day          destination        arrive     depart

    1          Tuesday      Barbados                       8.00pm
    1          Wednesday    at sea                at sea    at sea
    1          Thursday     Trinidad           8.00am    6.00pm
    1          Friday       Isla Margarita    8.00am     6.00pm
    1          Saturday     Grenada                  8.00am    6.00pm
    1          Sunday       St Lucia                   8.00am    6.00pm
    1          Monday       St Vincent          8.00am    6.00pm
    1          Tuesday      Barbados                  7.00am 
    2          Tuesday      Barbados                               8.00pm
    2          Wednesday    at sea           8            6
    2          Thursday     Tortola             8            7
    2          Friday       St Maarten        8            8
    2          Saturday     St Kitts             8              8
    2          Sunday       Antigua                    9            6 
    2          Monday       Dominica                   8            8
    2          Tuesday      Barbados                 7
a primary key identifies a unique row

looking at your data, i see several rows for itinerary #1

therefore, it cannot be the primary key



p.s. formatting is done with [code] stuff [/code]
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 04-03-07, 10:05
Sylvester Sylvester is offline
Registered User
 
Join Date: Apr 2007
Posts: 9
Thanks,

In the above example, The itineraryID, day & destination should make up a composite primary key. If that makes any difference?

Cheers Again
Reply With Quote
  #8 (permalink)  
Old 04-03-07, 10:06
Sylvester Sylvester is offline
Registered User
 
Join Date: Apr 2007
Posts: 9
With the itineraryId in the schedule table being a foreign key in the itinerary table.
Reply With Quote
  #9 (permalink)  
Old 04-03-07, 10:21
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by Sylvester
The itineraryID, day & destination should make up a composite primary key. If that makes any difference?
yes, it does make a difference, but that's not what you had
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #10 (permalink)  
Old 04-03-07, 10:25
Sylvester Sylvester is offline
Registered User
 
Join Date: Apr 2007
Posts: 9
lol, I know its cos the Underlines don't copy over when u cut & Paste!

So with that in mind would u say this is normalised to 3NF correctly???

& If so I'll be able to link this to a website using php. By this i mean that when i create a recordset in dreamwever will I have a seperate record for each arrival time etc??

Thanks for all ure help r937

P.s. where did u get the name r937??
Reply With Quote
  #11 (permalink)  
Old 04-03-07, 10:38
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
yes, it looks okay to me

assumption: an itinerary will never include two stops at the same destination on the same day

937 is my favourite number
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #12 (permalink)  
Old 04-03-07, 10:48
Sylvester Sylvester is offline
Registered User
 
Join Date: Apr 2007
Posts: 9
Well why didn't u just say so at the start, lol, )

Super mate, thanks alot, as I said above i just felt there was summit wrong when I was entering the data & I ended up with 8 itineraryId row 1's

Yep once they leave on place there headed to another!

lol most folks have a single digit fav number!

I'm still a little confused about how I'll pull back the individual times when I come to populate my "update Schedule" form fromt the database but as long as theres no glaring errors I think I'll go get the rest of my data n start to build the site!

Cheers again man!
Reply With Quote
  #13 (permalink)  
Old 04-03-07, 10:49
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
http://r937.com/what-does-r937-mean

To answer your PM - click reply -> find the Manage Attachments button. Click it and... manage your attachments
__________________
Testimonial:
Quote:
pootle flump
ur codings are working excelent.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On