database principles: fundamentals of design ... · pdf fileevery foreign key must either be...

70
Chapter 9 Normalizing Database Designs Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition

Upload: dangtram

Post on 13-Mar-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

Chapter 9

Normalizing Database Designs

Database Principles:

Fundamentals of Design,

Implementation, and

ManagementTenth Edition

Page 2: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

What is normalization?

Normalization is a procedure that is used to eliminate data

redundancy while ensuring data integrity.

Data integrity : ensures the quality of the data in the database

(satisfies data constraint rules. i.e. Primary Key,

Foreign Key, etc.)

Data redundancy: if data can be found in two places in a single

database (direct redundancy) or calculated using data from different

parts of the database (indirect redundancy) then redundancy exists.

The goal is to remove redundancy and other data modification

(insertion, update and deletion) problems

NORMALIZATION

Page 3: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

What is Data redundancy?

• When a group of attributes has multiple values then we say there isa repeating group of attributes in the relation

Title Year Length FilmType StudioName StarName

Harry Potter 2003 180 Color WarnerBros JK Rowling

Harry Potter 2003 180 Color WarnerBros Mark Hamill

Harry Potter 2003 180 Color WarnerBros Harrison Ford

Flight Plan 2005 110 Color Fox Judie Foster

Flight Plan 2005 110 Color Fox Sean Penn

Harry Potter 2005 190 Color WarnerBros JK Rowling

Harry Potter 2005 190 Color WarnerBros Mike Mayers

Example:

REPEATING GROUP

Movie

Page 4: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

If redundancy exists then this can cause problems during normal

database operations:

Updates - when some data needs altering, we find it's in

several places.

Insertion - When we want to insert something, we can't because

some other data is also required which we don't have.

Deletion - When something is deleted, other data is lost as well.

Problems of redundancy

Page 5: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Integrity Constraints

An integrity constraint is a rule that restricts the values that may be

present in the database.

Entity Integrity: The rows (or tuples) in a relation represent entities,

and each one must be uniquely identified.

Hence we have the primary key that must have a unique not-null

value for each row.

Referential Integrity: This constraint involves the foreign keys.

Foreign keys tie the relations together, so it is vitally important that

the links are correct. Every foreign key must either be null or its

value must be the actual value of a key in another relation.

Page 6: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Entity Integrity:

Selecting Primary Keys

• Primary key is the most important characteristic of an entity

– Single attribute or some combination of attributes

• Primary key’s function is to guarantee entity integrity

• Primary keys and foreign keys work together to implement relationships

• Properly selecting primary key has direct bearing on efficiency and effectiveness

Page 7: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Natural Keys and Primary Keys

• Natural key is a real-world identifier used to

uniquely identify real-world objects

– Familiar to end users and forms part of their day-

to-day business vocabulary

• Generally, data modeler uses natural identifier

as primary key of entity being modeled

• May instead use composite primary key or

surrogate key

Page 8: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Primary Key Guidelines

• Attribute that uniquely identifies entity instances

in an entity set

– Could also be combination of attributes

• Main function is to uniquely identify an entity

instance or row within a table

• Guarantee entity integrity, not to “describe” the

entity

• Primary keys and foreign keys implement

relationships among entities

– Behind the scenes, hidden from user

Page 9: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 10: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

When to Use Composite Primary Keys

• Composite primary keys useful in two cases:

– As identifiers of composite entities

• In which each primary key combination is allowed

once in M:N relationship

– As identifiers of weak entities

• In which weak entity has a strong identifying

relationship with the parent entity

• Automatically provides benefit of ensuring that

there cannot be duplicate values

Page 11: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 12: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

When to Use Composite Primary Keys

(cont’d.)

• When used as identifiers of weak entities

normally used to represent:

– Real-world object that is existent-dependent on

another real-world object

– Real-world object that is represented in data

model as two separate entities in strong

identifying relationship

• Dependent entity exists only when it is related

to parent entity

Page 13: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

When To Use Surrogate Primary Keys

• Especially helpful when there is:

– No natural key

– Selected candidate key has embedded semantic

contents

– Selected candidate key is too long or

cumbersome

Page 14: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

When To Use Surrogate Primary Keys

(cont’d.)

• If you use surrogate key:

– Ensure that candidate key of entity in question

performs properly

– Use “unique index” and “not null” constraints

Page 15: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 16: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Key: We can say that one or more attributes of a Relation can be a

Key for that Relation.

Those attributes functionally determine all other attributes of the

relation. (There can’t be more than one let say two distinct tuple that

is key for a Relation)

No proper subset of the Relation functionally determines all other

attributes of Relation.

A key must be minimal.

Super Key: Is an attribute or set of attributes whose closure

contains all attributes of the table. (A table may contain many S.K.)

Candidate Key: Is a minimal S.K. (Contains no attributes that are

not needed to form a S.K.) (A table may have many C.K.)

Primary Key: The C.K. chosen for implementation.

Each table has only 1 P.K.

KEY

Page 17: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Example

staffNo sName position salary branchNo bAddress

SL21 John White Manager 30000 B005 22 Deer Rd, London

SG37 Ann Beech Assistant 12000 B003 163 Main St, Glasgow

SG14 David Ford Supervisor 18000 B003 163 Main St, Glasgow

SA9 Mary Howe Assistant 9000 B007 16 Argyll St, Aberdeen

SG5 Susan Brand Manager 24000 B003 163 Main St, Glasgow

SL41 Julie Lee Assistant 9000 B005 22 Deer Rd, London

StaffBranch

staffNo sName, position, salary

branchNo bAddress

Functional Dependency?

Describes the relationship between the attributes in a relation

Reasonable Functional Dependencies (FDs):

So, what is the Key for StaffBranch Relation?

Page 18: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Closure of an attribute or set of attributes is the set that

contains all attributes that can be determined directly or

indirectly by the given attribute or set of attributes.

Procedure for Computing Closure of {A1,A2,…..An}

START ans={A1,A2,…..An}

REPEAT until ans does not change for each FD

if the Left Hand Side(LHS) is in ans

ADD the Right Hand Side(RHS) to ans

STOP

Closure is denoted by: { }+

Closure

Page 19: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Compute the Closures of given attributes:

FDs:

staffNo sName, position, salary

branchNo bAddress

Consider the following Relation and FDs:

StaffBranch(staffNo,sName,position,salary,branchNo,bAddress)

{staffNo}+= {staffNo,sName,position,salary}

{branchNo}+= {branchNo,bAddress}

{staffNo,branchNo}+={StaffNo,sName,position,salary, branchNo,

bAddress}

Computing Closure

Page 20: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Boyce Codd Normal Form

(BCNF)

A table is in BCNF if the determinant of all Functional Dependencies

are Super Key.

Procedure for BCNF:

• Step1: Check if the Functional Dependencies violate BCNF.

Compute closure of all determinants. Find the Functional

Dependencies (F.D.s) that violate BCNF.

• Step2: Choose any violating F.D. and form a new table from its

closure. List all F.D.s that valid on the new table. Find the Primary

Key.

• Step3: Eliminate all the non key attributes of the table formed in

Step2 from the table that you normalize. Form a new table from

the remainders. List all F.D.s that are valid on the new table.

Page 21: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

EXAMPLES will be solved in the

lecture session.

Page 22: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Database Tables and Normalization

• Normalization

– Process for evaluating and correcting table

structures to minimize data redundancies

• Reduces data anomalies

– Series of stages called normal forms:

• First normal form (1NF)

• Second normal form (2NF)

• Third normal form (3NF)

Page 23: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Database Tables and Normalization

(cont’d.)

• Normalization (continued)

– 2NF is better than 1NF; 3NF is better than 2NF

– For most business database design purposes,

3NF is as high as needed in normalization

– Highest level of normalization is not always most

desirable

• Denormalization produces a lower normal form

– Increased performance but greater data

redundancy

Page 24: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

The Need for Normalization

• Example: company that manages building

projects

– Charges its clients by billing hours spent on

each contract

– Hourly billing rate is dependent on employee’s

position

– Periodically, report is generated that contains

information such as displayed in Table 6.1

Page 25: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 26: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

The Need for Normalization (cont’d.)

• Structure of data set in Figure 9.1 does not

handle data very well

• Table structure appears to work; report is

generated with ease

• Report may yield different results depending on

what data anomaly has occurred

• Relational database environment is suited to

help designer avoid data integrity problems

Page 27: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

The Normalization Process

• Each table represents a single subject

• No data item will be unnecessarily stored in

more than one table

• All nonprime attributes in a table are dependent

on the primary key

• Each table is void of insertion, update, and

deletion anomalies

Page 28: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 29: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

The Normalization Process (cont’d.)

• Objective of normalization is to ensure that all

tables are in at least 3NF

• Higher forms are not likely to be encountered in

business environment

• Normalization works one relation at a time

• Progressively breaks table into new set of

relations based on identified dependencies

Page 30: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 31: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

The Normalization Process (cont’d.)

• Partial dependency

– Exists when there is a functional dependence in

which the determinant is only part of the primary

key

• Transitive dependency

– Exists when there are functional dependencies

such that X → Y, Y → Z, and X is the primary

key

Page 32: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Conversion to First Normal Form

• Repeating group

– Group of multiple entries of same type can exist

for any single key attribute occurrence

• Relational table must not contain repeating

groups

• Normalizing table structure will reduce data

redundancies

• Normalization is three-step procedure

Page 33: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Conversion to First Normal Form

(cont’d.)

• Step 1: Eliminate the Repeating Groups

– Eliminate nulls: each repeating group attribute

contains an appropriate data value

• Step 2: Identify the Primary Key

– Must uniquely identify attribute value

– New key must be composed

• Step 3: Identify All Dependencies

– Dependencies are depicted with a diagram

Page 34: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 35: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Conversion to First Normal Form

(cont’d.)

• Dependency diagram:

– Depicts all dependencies found within given

table structure

– Helpful in getting bird’s-eye view of all

relationships among table’s attributes

– Makes it less likely that you will overlook an

important dependency

Page 36: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 37: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Conversion to First Normal Form

(cont’d.)

• First normal form describes tabular format:

– All key attributes are defined

– No repeating groups in the table

– All attributes are dependent on primary key

• All relational tables satisfy 1NF requirements

• Some tables contain partial dependencies

– Dependencies are based on part of the primary

key

– Should be used with caution

Page 38: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Conversion to Second Normal Form

• Step 1: Make New Tables to Eliminate Partial

Dependencies

– Write each key component on separate line,

then write original (composite) key on last line

– Each component will become key in new table

• Step 2: Reassign Corresponding Dependent

Attributes

– Determine attributes that are dependent on

other attributes

– At this point, most anomalies have been

eliminated

Page 39: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 40: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Conversion to Second Normal Form

(cont’d.)

• Table is in second normal form (2NF) when:

– It is in 1NF and

– It includes no partial dependencies:

• No attribute is dependent on only portion of

primary key

Page 41: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Conversion to Third Normal Form

• Step 1: Make New Tables to Eliminate

Transitive Dependencies

– For every transitive dependency, write its

determinant as PK for new table

– Determinant: any attribute whose value

determines other values within a row

Page 42: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Conversion to Third Normal Form

(cont’d.)

• Step 2: Reassign Corresponding Dependent

Attributes

– Identify attributes dependent on each

determinant identified in Step 1

• Identify dependency

– Name table to reflect its contents and function

Page 43: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 44: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Conversion to Third Normal Form

(cont’d.)

• A table is in third normal form (3NF) when both

of the following are true:

– It is in 2NF

– It contains no transitive dependencies

Page 45: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Improving the Design

• Table structures should be cleaned up to

eliminate initial partial and transitive

dependencies

• Normalization cannot, by itself, be relied on to

make good designs

• Valuable because it helps eliminate data

redundancies

Page 46: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Improving the Design (cont’d.)

• Issues to address, in order, to produce a good

normalized set of tables:

– Evaluate PK Assignments

– Evaluate Naming Conventions

– Refine Attribute Atomicity

– Identify New Attributes

Page 47: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Improving the Design (cont’d.)

– Identify New Relationships

– Refine Primary Keys as Required for Data

Granularity

– Maintain Historical Accuracy

– Evaluate Using Derived Attributes

Page 48: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 49: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 50: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Surrogate Key Considerations

• When primary key is considered to be

unsuitable, designers use surrogate keys

• Data entries in Table 6.4 are inappropriate

because they duplicate existing records

– No violation of entity or referential integrity

Page 51: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Higher-Level Normal Forms

• Tables in 3NF perform suitably in business

transactional databases

• Higher-order normal forms are useful on

occasion

• Two special cases of 3NF:

– Boyce-Codd normal form (BCNF)

– Fourth normal form (4NF)

Page 52: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

The Boyce-Codd Normal Form

• Every determinant in table is a candidate key

– Has same characteristics as primary key, but for

some reason, not chosen to be primary key

• When table contains only one candidate key,

the 3NF and the BCNF are equivalent

• BCNF can be violated only when table contains

more than one candidate key

Page 53: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

The Boyce-Codd Normal Form

(cont’d.)

• Most designers consider the BCNF as a special

case of 3NF

• Table is in 3NF when it is in 2NF and there are

no transitive dependencies

• Table can be in 3NF and fail to meet BCNF

– No partial dependencies, nor does it contain

transitive dependencies

– A nonkey attribute is the determinant of a key

attribute

Page 54: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 55: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 56: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 57: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Fourth Normal Form (4NF)

• Table is in fourth normal form (4NF) when both

of the following are true:

– It is in 3NF

– No multiple sets of multivalued dependencies

• 4NF is largely academic if tables conform to

following two rules:

– All attributes dependent on primary key,

independent of each other

– No row contains two or more multivalued facts

about an entity

Page 58: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 59: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 60: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Normalization and Database Design

• Normalization should be part of the design

process

• Make sure that proposed entities meet required

normal form before table structures are created

• Many real-world databases have been

improperly designed or burdened with

anomalies

• You may be asked to redesign and modify

existing databases

Page 61: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Normalization and Database Design

(cont’d.)

• ER diagram

– Identify relevant entities, their attributes, and

their relationships

– Identify additional entities and attributes

• Normalization procedures

– Focus on characteristics of specific entities

– Micro view of entities within ER diagram

• Difficult to separate normalization process from

ER modeling process

Page 62: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 63: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 64: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 65: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 66: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Page 67: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Denormalization

• Creation of normalized relations is important

database design goal

• Processing requirements should also be a goal

• If tables are decomposed to conform to

normalization requirements:

– Number of database tables expands

Page 68: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Denormalization (cont’d.)

• Joining the larger number of tables reduces

system speed

• Conflicts are often resolved through

compromises that may include denormalization

• Defects of unnormalized tables:

– Data updates are less efficient because tables

are larger

– Indexing is more cumbersome

– No simple strategies for creating virtual tables

known as views

Page 69: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

Data-Modeling Checklist

• Data modeling translates specific real-world

environment into data model

– Represents real-world data, users, processes,

interactions

• Data-modeling checklist helps ensure that data-

modeling tasks are successfully performed

• Based on concepts and tools learned in Part II

Page 70: Database Principles: Fundamentals of Design ... · PDF fileEvery foreign key must either be null or its ... (BCNF) A table is in BCNF if the determinant of all Functional Dependencies

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.

© 2013 Cengage Learning. All Rights Reserved. This edition is intended for use outside of the U.S. only, with content that may be different from the U.S. Edition.

May not be scanned, copied, duplicated, or posted to a publicly accessible website, in whole or in part.