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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-24-11, 20:03
gary223 gary223 is offline
Registered User
 
Join Date: Apr 2011
Posts: 17
Normalisation

I've been trying to self-learn normalisation for the last while and I just don't understand it. If you could help me normalise the below, I think I could understand it a little better.

author, date of birth of author, title, isbn, number of pages, author's nationality, genre, publisher, publisher's city, publisher's phone number

Zero normal form
author
date of birth of author
title
isbn
number of pages
author's nationality
genre
publisher
publisher's city
publisher's phone number

First normal form
author
name
date of birth
nationality

book
title
isbn
number of pages
genre

publisher
name
city
phone number

Second normal form
author
author_id
name
date of birth
nationality

book
book_id
title
isbn
number of pages
genre

publisher
publisher_id
name
city
phone number

Third normal form
author
author_id
name
date of birth
nationality

book
book_id
title
isbn
number of pages
genre

publisher
publisher_id
name
city
phone number

all_id
author_id
book_id
publisher_id
Reply With Quote
  #2 (permalink)  
Old 04-24-11, 20:06
gary223 gary223 is offline
Registered User
 
Join Date: Apr 2011
Posts: 17
Sorry for posting this three times. I don't know why it did that. Probably my browser.
Reply With Quote
  #3 (permalink)  
Old 04-24-11, 20:27
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by gary223 View Post
all_id
author_id
book_id
publisher_id
what's this?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 04-24-11, 20:34
gary223 gary223 is offline
Registered User
 
Join Date: Apr 2011
Posts: 17
Quote:
Originally Posted by r937 View Post
what's this?
Its where I join up all the tables for third normal form.
Reply With Quote
  #5 (permalink)  
Old 04-24-11, 20:46
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
o rly?

and which table is that?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #6 (permalink)  
Old 04-24-11, 20:51
gary223 gary223 is offline
Registered User
 
Join Date: Apr 2011
Posts: 17
Quote:
Originally Posted by r937 View Post
o rly?

and which table is that?
Its a table that joins the author, book and publisher tables.

Is it incorrect?
Reply With Quote
  #7 (permalink)  
Old 04-24-11, 21:20
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by gary223 View Post
Its a table that joins the author, book and publisher tables.
what is the table name?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #8 (permalink)  
Old 04-24-11, 21:24
gary223 gary223 is offline
Registered User
 
Join Date: Apr 2011
Posts: 17
Quote:
Originally Posted by r937 View Post
what is the table name?
Hmm...I don't think I named it. I guess it should be:

all
all_id
author_id
book_id
publisher_id
Reply With Quote
  #9 (permalink)  
Old 04-24-11, 21:26
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
what is the "all_id" for?

more importantly, what do the rows of that table look like for a book that has more than one author?

hint: it is ~so~ not normalized
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #10 (permalink)  
Old 04-24-11, 21:32
gary223 gary223 is offline
Registered User
 
Join Date: Apr 2011
Posts: 17
Quote:
Originally Posted by r937 View Post
what is the "all_id" for?

more importantly, what do the rows of that table look like for a book that has more than one author?

hint: it is ~so~ not normalized
The all_id is the primary key for all table. How would you do it?
Reply With Quote
  #11 (permalink)  
Old 04-24-11, 21:48
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
Quote:
Originally Posted by gary223 View Post
The all_id is the primary key for all table.
you will lose marks for such an ill-advised idea

Quote:
Originally Posted by gary223 View Post
How would you do it?
fix the books-to-authors relationship first
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #12 (permalink)  
Old 04-25-11, 23:07
fr0s1yjack fr0s1yjack is offline
Registered User
 
Join Date: Apr 2011
Posts: 21
1NF: identify repeating data from the rest, give it a primary key and establish link between the (now) two tables (carry over primary key and make it a foreign key in the new table)
2NF: remove partial dependencies (test all the fields in your non repeating data table against its brand new composite key, does this field depend on the primary key? yes? no, how about the foreign key? if partially dependent on one of them separate it into a new table carrying the key with it)
3NF: remove non partial dependencies

r937 is that right? (in simple(ish) terms)

gary223 i remember normalising the same data set last year, it was one of the first few we did. good times.
Reply With Quote
  #13 (permalink)  
Old 04-25-11, 23:53
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
yes, that's pretty much correct, jack

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #14 (permalink)  
Old 04-26-11, 00:35
fr0s1yjack fr0s1yjack is offline
Registered User
 
Join Date: Apr 2011
Posts: 21
Quote:
Originally Posted by r937 View Post
yes, that's pretty much correct, jack

sweet
Reply With Quote
  #15 (permalink)  
Old 04-27-11, 17:24
Pukisoft Pukisoft is offline
Registered User
 
Join Date: Jul 2008
Posts: 7
I believe you need to normalize the genres field to it's own table for the table to be truly in 3rd normal form.

Otherwise you might end up having genres like sci-fi, scifi, SYFI etc.
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