Upload
channing-marcel
View
19
Download
2
Embed Size (px)
DESCRIPTION
DBS201: Normalization Review. Agenda. Steps of Normalization. Bottom Up Database Design. Bottom Up Provided with views of data Views can be screen shots or reports (printouts) Views contain fields (data) Need to groups fields together – find fields that are in common Result is tables. - PowerPoint PPT Presentation
Citation preview
DBS201: Normalization Review
Agenda
Steps of Normalization
Bottom Up Database Design
Bottom Up Provided with views of data Views can be screen shots or reports (printouts) Views contain fields (data) Need to groups fields together – find fields that are
in common Result is tables
Normalization
Works through a series of stages called normal forms:
Normal form (1NF)Second normal form (2NF)Third normal form (3NF)
First Normal Form
1. Eliminate repeating groups Present data in a tabular format, where each cell
has a single value and there are no repeating groups
Eliminate repeating groups by eliminating nulls, making sure that each repeating group attribute contains an appropriate data value
2. Identify candidate primary key Primary key must uniquely identify attribute
values (a row)3. State table structure (will show functional
dependencies)
First Normal Form
Identify candidate primary key Identify an attribute who’s value is
different in each row, or Look for any pair of attribute which when
concatenated produce a unique value
First Normal Form
Identify candidate primary key Primary key must uniquely identify attribute values (a row) What is a candidate for primary key in the following?
AttribA AttribB AttribC AttribD AttribE AttribFQQQO WWWO EEEO RRRO TTJO YVYOQQOQ WWVO FEFO RRPO TJTO YYVO QOQQ
WVWO FEEO RPRO JTTO VYYOQOOQ VWWO EFEO PRRO JJTO VYVOQOQO WWWO FEFO PPRO JTJO YYYOQQQO VWVO EEFO PPRO TJJO VYVO
First Normal Form
Identify candidate primary key What is a candidate for primary key in the
following?
AttribA AttribB AttribC AttribD AttribE AttribF
QQQO WWWO EEEO RRRO TTJO YVYOQQOQ WWVO FEFO RRPO TJTO YYVO QOQQ WVWO FEEO RPRO JTTO VYYOQOOQ VWWO EFEO PRRO JJTO VYVOQOQO WWWO FEFO PPRO JTJO YYYOQQQO VWVO EEFO PPRO TJJO VYVO
Only atttribE is a candidate – because it’s value is different in each row
First Normal Form
Identify candidate primary key Primary key must uniquely identify
attribute values (a row) What is a candidate for primary key in the
following?
A B C D E
Horse 2 years $500,000 Mohawk Race Track Lightening Rod
GreyHound 3 years $125,000 Tampa Florida Speckled Speed
Horse 1 year $80,000 Blue Bonnet Raceway Slow Harry
GreyHound 4 years $125,000 Hialia Atlantic City All Leggs
First Normal Form
Identify candidate primary key Primary key must uniquely identify
attribute values (a row) What is a candidate for primary key in the
following?
A B C D E
Horse 2 years $500,000 Mohawk Race Track All Leggs
GreyHound 3 years $125,000 Tampa Florida Speckled Speed
Horse 1 year $80,000 Blue Bonnet Raceway Slow Harry
GreyHound 4 years $125,000 Hialia Atlantic City All Leggs
First Normal Form
What is a candidate for primary key in the following?
Award Player Name
Player Number Position Team Year
Best Defense Joe Wall 17 Left Defense Toronto 1999
Sy Stopp 7 Right Defense Detroit 2000
Pete Puck 22 Left Defense Montreal 2001
Joe Wall 17 Left Wing Toronto 2002
Most Valuable Sam Scores 18 Center Chicago 1999
Wayne Gretzky 99 Center New York 2000
Joe Wall 17 Left Wing Toronto 2002
First Normal Form
What is a candidate for primary key in the following?
Award Player Name Player Number Position Team Year
Best Defense Joe Wall 17 Left Defense Toronto 1999
Best Defense Sy Stopp 7 Right Defense Detroit 2000
Best Defense Pete Puck 22 Left Defense Montreal 2001
Best Defense Joe Wall 17 Left Wing Toronto 2002
Most Valuable Sam Scores 18 Center Chicago 1999
Most Valuable Wayne Gretzky 99 Center New York 2000
Most Valuable Joe Wall 17 Left Wing Toronto 2002
First Normal Form
What is a candidate for primary key in the following?
Team + Year…………No
Position + Team……..No
Position + Year………No
PNumber + Position….No
PNumber + Team…….No
PNumber + Year……..No
PlayerName + PNumber …No
PlayerName + Position……No
PlayerName + Team………No
PlayerName + Year……….No
Award + PlayerName……..No
Award + PNumber………...No
Award + Position………….No
Award + Team…………….No
Award + Year……………..Yes
Second Normal Form
1. Identify partial primary keys2. Determine which attributes are dependent on
the partial primary key3. State table structures (will show partial
dependencies) Write each table structure on a separate line with
it’s primary key Write the original (composite) key on the last line
with attributes removed that have been moved to the new table structures
Third Normal Form
1. For every transitive dependency, identify the determinant – it will be taken from a non-key attribute (will become the PK for a new table)
2. Determine which non-key attributes are dependent on this new primary key
3. State table structures (will show transitive dependencies) Write each table structure on a separate line with
it’s primary new key Write the partial dependency table structures Write the original (composite) key on the last line
with attributes removed that have been moved to the new table structures
Third Normal Form
1. For every transitive dependency, identify the determinant – it will be taken from a non-key attribute (will become the PK for a new table)
2. Determine which non-key attributes are dependent on this new primary key
3. State table structures (will show transitive dependencies) Write each table structure on a separate line with
it’s primary new key Write the partial dependency table structures Write the original (composite) key on the last line
with attributes removed that have been moved to the new table structures