Functional Dependence An attribute A is functionally dependent on attribute(s) B if: given a value b for B there is one and only one corresponding value.

Slides:



Advertisements
Similar presentations
1 Logical Database Design and the Relational Model Modern Database Management.
Advertisements

Systems Development Life Cycle
© 2005 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B.
Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
© 2005 by Prentice Hall Chapter 3a Database Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Modern Systems Analysis and Design Third Edition
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
© 2007 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 8 th Edition Jeffrey A. Hoffer, Mary B.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Database Design: Normalization
Normalization Rules for Database Tables Northern Arizona University College of Business Administration.
10-1 Chapter 10 Designing Databases Modern Systems Analysis and Design Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 4: Logical Database Design and the Relational Model Modern Database Management 10.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
Chapter 4: Logical Database Design and the Relational Model (Part II)
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
Week 6 Lecture Normalization
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 2 Slide 1 Chapter 10 Designing Databases.
Concepts and Terminology Introduction to Database.
CMPE 226 Database Systems September 16 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
Avoiding Database Anomalies
Lecture 12 Designing Databases 12.1 COSC4406: Software Engineering.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
Logical Database Design Relational Model. Logical Database Design Logical database design: process of transforming conceptual data model into a logical.
10/3/2012ISC329 Isabelle Bichindaritz1 Logical Design.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
Data Models and Relational Databases Chapter 2. Learning Objectives Identify primary and foreign keys for each entity and relevant relationships in the.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Logical Database Design and the Relational Model.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part c): Logical Database Design and the Relational Model Modern Database Management.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Essentials of Systems Analysis and Design Fourth Edition Joseph S. Valacich Joey F.
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter 9 Designing Databases.
Chapter 10 Designing Databases. Objectives:  Define key database design terms.  Explain the role of database design in the IS development process. 
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Chapter 9 Designing Databases 9.1.
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
Logical Database Design and the Relational Model.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 3: LOGICAL DATABASE.
© 2007 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 8 th Edition Jeffrey A. Hoffer, Mary B.
Lecture 4: Logical Database Design and the Relational Model 1.
Logical Design 12/10/2009GAK1. Learning Objectives How to remove features from a local conceptual model that are not compatible with the relational model.
NormalisationNormalisation Normalization is the technique of organizing data elements into records. Normalization is the technique of organizing data elements.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
Logical Database Design and Relational Data Model Muhammad Nasir
Chapter 4 © 2013 Pearson Education, Inc. Publishing as Prentice Hall Chapter 4: Logical Database Design and the Relational Model Modern Database Management.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 12 Designing.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 4: PART C LOGICAL.
Converting ER/EER to logical schema; physical design issues 1.
Chapter 4 Logical Database Design and the Relational Model
Chapter 4: Logical Database Design and the Relational Model
Chapter 5: Logical Database Design and the Relational Model
MIS 322 – Enterprise Business Process Analysis
Modern Systems Analysis and Design Third Edition
Chapter 9 Designing Databases
Relational Model and ER Model: in a Nutshell
© 2011 Pearson Education, Inc. Publishing as Prentice Hall
Relational Database.
Chapter 9 Designing Databases
Chapter 12 Designing Databases
Chapter 10 Designing Databases
Presentation transcript:

Functional Dependence An attribute A is functionally dependent on attribute(s) B if: given a value b for B there is one and only one corresponding value a for A (at a time). b2b2 b3b3 a1a1 b1b1

Example: functional dependence All sales representatives in a given pay class have the same commission rate. SalesRepNumberNamePayClassCommission

Normal Forms  A set of conditions on table structure that improves maintenance. Normalization removes processing anomalies:  Update  Inconsistent Data  Addition  Deletion

Normal Forms All attributes depend on the key, the whole key and nothing but the key. 1NFKeys and no repeating groups 2NFNo partial dependencies 3NFAll determinants are candidate keys 4NFNo multivalued dependencies

6 EXAMPLE PLAYERIDPOSITIONPLAYER_NA ME COACHCoach City 01ForwardRonaldoJoeLondon 02MidfieldZidaneEdMadrid 03ForwardRooneyPeteManchester 04GoalCassilasJimBarcelona 05ForwardFabregasJoeLondon 01MidfieldRonaldoEdMadrid Player_id Coach Position Player Name City Transitive Dependency Partial Functional Dependencies

1st Normal Form  Table has a primary key  Table has no repeating groups  Anomalies in 1 st normal form  Inserting  We cannot enter the fact that a player information until his position is known  Solved in 2 nd Normal form  Cannot Enter a Coach and City information with an assigned player and position  Solved in 3 rd Normal Form  Deleting  If we Delete Player id 03 we loose information about coach “Pete”.  Solved in 3 rd Normal Form  Updating  If coach Joe moves from London to Amsterdam,we have to search for all relevant tuples and update them  Will be solved in 3 rd Normal Form

8 Second Normal Form  A relation R is in 2 NF if and only if it is in 1NF and every non-key attribute is fully dependent on the primary key  Partial functional dependency: one or more non-key attributes are functionally dependent on part of the primary key PLAYERI D Player Name 01Ronaldo 02Zidane 03Rooney 04Cassilas 05Fabregas PLAYERIDPOSITIONCOACHCoach City 01ForwardJoeLondon 02MidfieldEdMadrid 03ForwardPeteManchester 04GoalJimBarcelona 05ForwardJoeLondon 01MidfieldEdMadrid

9 Anomalies (2 NF)  Inserting  We cannot insert Coach and City Information unless Player id and Position is identified.  Deleting  If we Delete Player id 03 we loose information about coach “Pete”.  Updating  If coach Joe moves from London to Amsterdam,we have to search for all relevant tuples and update them  Will be solved in 3 rd Normal Form

10 Third Normal Form  A relation is in 3 NF if and only if it is in 2 NF and every non-key attribute is non-transitively dependent on the primary key  Transitive Dependency: functional dependency between two or more non-key attributes in a relation PLAYERIDPlayer Name 01Ronaldo 02Zidane 03Rooney 04Cassilas 05Fabregas PLAYERIDPOSITIONCOACH 01ForwardJoe 02MidfieldEd 03ForwardPete 04GoalJim 05ForwardJoe 01MidfieldEd CoachCoach City JoeLondon EdMadrid PeteManchester JimBarcelona

Normalization 1NFKeys & no repeating groups 2NF1NF & all attributes depend on all key components 3NF2NF & all determinants are candidate keys  Pros: Improves maintenance for database changes  Cons: Tends to slow down retrieval

Transforming E-R Diagrams into Relations  Foreign Key  An attribute that appears as a nonprimary key attribute in one relation and as a primary key attribute (or part of a primary key) in another relation  Referential Integrity  An integrity constraint specifying that the value (or existence) of an attribute in one relation depends on the value (or existence) of the same attribute in another relation Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall 9.12

Transforming E-R Diagrams into Relations (Continued)  It is useful to transform the conceptual data model into a set of normalized relations  Steps: 1.Represent entities 2.Represent relationships 3.Normalize the relations 4.Create Tables Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall 9.13

Transforming E-R Diagrams into Relations (continued) 1. Represent Entities  Each regular entity is transformed into a relation  The identifier of the entity type becomes the primary key of the corresponding relation  The primary key must satisfy the following two conditions a.The value of the key must uniquely identify every row in the relation b.The key should be non-redundant Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall 9.14

Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall 9.15

Transforming E-R Diagrams into Relations (continued) 2. Represent Relationships  Binary 1:N Relationships  Add the primary key attribute (or attributes) of the entity on the one side of the relationship as a foreign key in the relation on the right side  The one side migrates to the many side Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall 9.16

Transforming E-R Diagrams into Relations (continued) 2. Represent Relationships (continued)  Binary or Unary 1:1  Three possible options: a. Add the primary key of A as a foreign key of B b. Add the primary key of B as a foreign key of A c. Both  Binary and higher M:N relationships  Create another relation and include primary keys of all relations as primary key of new relation Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall 9.17

Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall 9.18

Transforming E-R Diagrams into Relations (continued)  Unary 1:N Relationships  Relationship between instances of a single entity type  Utilize a recursive foreign key  A foreign key in a relation that references the primary key values of that same relation  Unary M:N Relationships  Create a separate relation  Primary key of new relation is a composite of two attributes that both take their values from the same primary key Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall 9.19

Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall 9.20