Monday, March 26, 2012

Normalization - help me understand

Hello,
I guess this is a good brief definition for Normalization. I am
trying to understand what is the sentence "and are not and are not
dependent on any non-key ATTRIBUTEs." in the definition.
"Normalization is the process of designing database tables to ensure
that the fields in each table do not repeat, are fully identified by a
unique KEY, and are not dependent on any non-key ATTRIBUTEs."
For instance a table Employee has three columns
EmpID PK
EmpFname varchar(50)
EmpRole varchar(50)
...
are the non-key attributes mean the key that are not neither PK nor FK
in a table like EmpFname and EmpRole in the table Employee?
And also if you are not rush , please let me know how could we define
1st Normalization, II Normalization and III Normalization. And in most
projects to what normalization level we need to normalize the data.
Thanks,
-LFor the first part, consider a table such as this:
CREATE TABLE dbo.Courses
(
Course_ID int NOT NULL,
City varchar(50) NULL,
Country varchar(50) NULL
)
go
ALTER TABLE dbo.CoursesADD CONSTRAINT
PK_Courses PRIMARY KEY CLUSTERED
(
Course_ID
)
go
This voilates the condition you quote, as the Course City depends on Course
Country - and we should therefore have a separate table for course
locations.
For the second part, I can't go into all the details about normalization
here - it's too lengthy. You'll need a decent design book for that (eg Pro
SQL Server 2005 Database Design and Optimization by Louis Davidson, Kevin
Kline and Kurt Windisch.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com|||Hello Paul,
Thanks for the quick reply. Sorry to bother you one more time but I
couldn't understand
From: Paul Ibison - view profile
Date: Fri, Aug 11 2006 9:44 am
Email: "Paul Ibison" <Paul.Ibi...@.Pygmalion.Com>
Groups: microsoft.public.sqlserver.server
Not yet ratedRating:
show options
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Report Abuse | Find messages by this author
For the first part, consider a table such as this:
CREATE TABLE dbo.Courses
(
Course_ID int NOT NULL,
City varchar(50) NULL,
Country varchar(50) NULL
)
go
ALTER TABLE dbo.CoursesADD CONSTRAINT
PK_Courses PRIMARY KEY CLUSTERED
(
Course_ID
)
go
This voilates the condition you quote, as the Course City depends on
Course
Country - and we should therefore have a separate table for course
locations.
your explanation on this. Could you please take couple of more minutes
to explain it?
Thanks
-L
Paul Ibison wrote:
> For the first part, consider a table such as this:
> CREATE TABLE dbo.Courses
> (
> Course_ID int NOT NULL,
> City varchar(50) NULL,
> Country varchar(50) NULL
> )
> go
> ALTER TABLE dbo.CoursesADD CONSTRAINT
> PK_Courses PRIMARY KEY CLUSTERED
> (
> Course_ID
> )
> go
> This voilates the condition you quote, as the Course City depends on Cours
e
> Country - and we should therefore have a separate table for course
> locations.
> For the second part, I can't go into all the details about normalization
> here - it's too lengthy. You'll need a decent design book for that (eg Pro
> SQL Server 2005 Database Design and Optimization by Louis Davidson, Kevin
> Kline and Kurt Windisch.
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com|||Course Cities depend on Course Countries, but each attribute should just
relate to the Key, so Course Cities violates the rule. This example shows
the importance of reducing redundancy, so if we had a lot of courses in
London, England, the relationship between London and England would be
repeated unnecessarily for each course. Also, the dependancy between London
and England has been hidden as data in a table, so if it were to change,
this would be very bad news. Ridiculous you might think! But if it was city
and county, in the UK we have changed county boundaries so that this has
occured, and it will be a problem in many database tables designed this way.
This is a big subject so I had a trawl through a few websites and I quite
like this explanation of all the rules that I hope you'll find useful:
http://www.datamodel.org/NormalizationRules.html#four
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com|||On 11 Aug 2006 05:43:41 -0700, "Learner" <pradev@.gmail.com> wrote:
>And also if you are not rush , please let me know how could we define
>1st Normalization, II Normalization and III Normalization. And in most
>projects to what normalization level we need to normalize the data.
There's a saying that 1NF, 2NF, and 3NF amount to:
The key,
The whole key,
and nothing but the key.
Which is pretty close!
Congratulations, if you can recite this on demand, you will come off
as better educated than about half the "DBA's" out there.
1NF includes some other stuff, and I don't think 2NF makes any sense,
really. The fun starts after 3NF - it seldom matters, but when it
does, it makes you feel good to know about it!
The idea behind normalization is that there are algebraic and semantic
ideas that work if and only if the rules for normalization are
followed, but you don't have to recite those, just the mechanical
rules.
J.sql

No comments:

Post a Comment