Lecture 7 Enhanced Entity-Relationship Modelling & Advanced Normalisation.

Slides:



Advertisements
Similar presentations
3/25/2017.
Advertisements

Feichter_DPG-SYKL03_Bild-01. Feichter_DPG-SYKL03_Bild-02.
© 2008 Pearson Addison Wesley. All rights reserved Chapter Seven Costs.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Chapter 1 The Study of Body Function Image PowerPoint
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
UNITED NATIONS Shipment Details Report – January 2006.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Fourth normal form: 4NF 1. 2 Normal forms desirable forms for relations in DB design eliminate redundancies avoid update anomalies enforce integrity constraints.
1 Term 2, 2004, Lecture 3, NormalisationMarian Ursu, Department of Computing, Goldsmiths College Normalisation 5.
Conceptual / semantic modelling
1 Term 2, 2007, Lectures 2/3, NormalisationD. Tidhar (based on M. Ursu) Department of Computing, Goldsmiths College Normalisation 5.
Database Design: ER Modelling (Continued)
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
Normalization of Database Tables
VOORBLAD.
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
1..
© 2012 National Heart Foundation of Australia. Slide 2.
Functional Dependencies and Normalization for Relational Databases
Model and Relationships 6 M 1 M M M M M M M M M M M M M M M M
25 seconds left…...
Analyzing Genes and Genomes
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Chapter 12 Enhanced Entity-Relationship Modeling Transparencies © Pearson Education Limited 1995, 2005.
Intracellular Compartments and Transport
PSSA Preparation.
Essential Cell Biology
Enhanced/Extended Relationship-Diagram
1 Pertemuan Perluasan E-R Matakuliah: >/ > Tahun: > Versi: >
The Relational Model System Development Life Cycle Normalisation
1 Database Systems: A Practical Approach to Design, Implementation and Management International Computer Science S. Carolyn Begg, Thomas Connolly Lecture.
1 Database Systems: A Practical Approach to Design, Implementation and Management International Computer Science S. Carolyn Begg, Thomas Connolly Lecture.
Enhanced ER modeling techniques Transparencies
Entity-Relationship (E-R) Model
Normalization II. Boyce–Codd Normal Form (BCNF) Based on functional dependencies that take into account all candidate keys in a relation, however BCNF.
Enhanced Entity-Relationship Model (EER) 1. Enhanced-ER (EER) Model Concepts Includes all modeling concepts of basic ER Additional concepts: subclasses/superclasses,
Lecture 12 Inst: Haya Sammaneh
Normalization. Learners Support Publications 2 Objectives u The purpose of normalization. u The problems associated with redundant data.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
CSC271 Database Systems Lecture # 28.
CSC271 Database Systems Lecture # 25. Summary: Previous Lecture  Structural constraints  Multiplicity  Cardinality  Participation  Connection traps.
Enhanced Entity-Relationship Modeling
9/23/2012ISC329 Isabelle Bichindaritz1 Normalization.
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
Basic ER modeling was adequate for simpler databases, but in the 1980’s more demanding databases required more extensive modeling requirements. Some such.
Enhanced Entity-Relationship Modeling
Enhanced Entity-Relationship Modeling
Advanced Normalization
Normalization DBMS.
Normalization Dongsheng Lu Feb 21, 2003.
Logical Database Design for the Relational Model
Enhanced ER Modeling Transparencies
Advanced Normalization
Chapter 13 Enhanced Entity-Relationship Modeling
Normalization.
Normalization.
Normalization Dongsheng Lu Feb 21, 2003.
Enhanced Entity-Relationship Modeling
Enhanced Entity-Relationship Modeling Transparencies
Enhanced Entity-Relationship Modeling Transparencies
Enhanced Entity-Relationship Modeling
Enhanced Entity-Relationship Modeling
Enhanced Entity-Relationship Modeling
Presentation transcript:

Lecture 7 Enhanced Entity-Relationship Modelling & Advanced Normalisation

2 Lecture 7 – Part 1 Enhanced Entity-Relationship Modelling

3 Introduction Limitations of basic concepts of the ER model and requirements to represent more complex applications using additional data modelling concepts. Most useful additional data modelling concepts of Enhanced ER (EER) model called: –specialization/generalization; –aggregation; –composition. EER diagram using UML.

4 Specialization / Generalization Superclass – An entity type that includes one or more distinct subgroupings of its occurrences. Subclass – A distinct subgrouping of occurrences of an entity type. Superclass/subclass relationship is one-to-one. Superclass may contain overlapping or distinct subclasses. Not all members of a superclass need be a member of a subclass.

5 Specialization / Generalization Attribute Inheritance – An entity in a subclass represents same real world object as in superclass, and may possess subclass-specific attributes, as well as those associated with the superclass.

6 Specialization / Generalization Specialization – Process of maximizing differences between members of an entity by identifying their distinguishing characteristics. Generalization – Process of minimizing differences between entities by identifying their common characteristics.

7 Specialization/Generalization - Example Doctor(doc_staffno, roomno, telno, training_hospital, date_qualified) Surgeon(sur_staffno, roomno, telno, training_hospital, date_qualified, speciality) Consultant(con_staffno, roomno, telno, training_hospital, date_qualified, specialism) Doctor SurgeonConsultant is_surgeonis_consultant Inefficient Representation

8 Specialization/Generalization – Example Bachmans Notation Doctor SurgeonConsultant specialityspecialism doc_staffno roomno …

9 Specialization/Generalization – Example UML Notation Doctor Surgeon Consultant speciality specialism Staffno Roomno Telno Training_hospital Date_qualified

10 AllStaff Relation Holding Details of all Staff

11 Specialization/Generalization of Staff Entity into Subclasses Representing Job Roles

12 Specialization/Generalization of Staff Entity into Job Roles and Contracts of Employment

13 EER Diagram with Shared Subclass and Subclass with its own Subclass

14 Constraints on Specialization / Generalization Two constraints that may apply to a specialization/generalization: –participation constraints, –disjoint constraints. Participation constraint –Determines whether every member in superclass must participate as a member of a subclass. –May be mandatory or optional.

15 Constraints on Specialization / Generalization Disjoint constraint –Describes relationship between members of the subclasses and indicates whether member of a superclass can be a member of one, or more than one, subclass. –May be disjoint or nondisjoint.

16 Constraints on Specialization / Generalization There are four categories of constraints of specialization and generalization: –mandatory and disjoint; –optional and disjoint; –mandatory and nondisjoint; –optional and nondisjoint.

17 DreamHome Example - Staff Superclass with Supervisor and Manager Subclasses

18 DreamHome Example - Owner Superclass with PrivateOwner and BusinessOwner Subclasses

19 Converting Superclass/Subclass Relationship into Relational Model

20 Converting Superclass/Subclass Relationship into Relational Model Option 1 – Mandatory, Nondisjoint (And) AllOwner (ownerNo, address, telNo, fName, lName, bName, bType, contactName, pOwnerFlag, bOwnerFlag) {Mandatory, And}

21 Converting Superclass/Subclass Relationship into Relational Model Option 2 – Optional, Nondisjoint (And) Owner (ownerNo, address, telNo) OwnerDetails (ownerNo*, fName, lName, bName, bType, contactName, pOwnerFlag, bOwnerFlag) {Optional, And}

22 Converting Superclass/Subclass Relationship into Relational Model Option 3 – Mandatory, Disjoint (Or) PrivateOwner (ownerNo, fName, lName, address, telNo) BusinessOwner (ownerNo, bName, bType, contactName, address, telNo) {Mandatory, Or}

23 Converting Superclass/Subclass Relationship into Relational Model Option 4 – Optional, Disjoint (Or) Owner (ownerNo, address, telNo) PrivateOwner (ownerNo*, fName, lName) BusinessOwner (ownerNo*, bName, bType, contactName) {Optional, Or}

24 Aggregation Represents a has-a or is-part-of relationship between entity types, where one represents the whole and the other the part.

25 Examples of Aggregation

26 Composition Specific form of aggregation that represents an association between entities, where there is a strong ownership and coincidental lifetime between the whole and the part.

27 Example of Composition

28 Lecture 7 – Part 2 Advanced Normalization

29 Boyce–Codd Normal Form (BCNF) BCNF - A relation is in BCNF if and only if every determinant (of a functional dependency) is a candidate key. Violation of BCNF is quite rare. Potential to violate BCNF may occur in a relation that: –contains two (or more) composite candidate keys; or –the candidate keys overlap (i.e. have at least one attribute in common).

30 BCNF - Example clientNointerviewDateinterviewTimestaffNoroomNo CR7613-May-0510:30SG5G101 CR5613-May-0512:00SG5G101 CR7413-May-0512:00SG37G102 CR561-Jul-0510:30SG5G102 The relation ClientInterview stores information on client interviews by members of staff. The relation has 3 candidate keys: (clientNo, interviewDate), (staffNo, interviewDate, interviewTime), and (roomNo, interviewDate, interviewTime). The 3 composite candidate keys share a common attribute interviewDate

31 BCNF - Example We select (clientNo, interviewDate) to be the primary key: ClientInterview (clientNo, interviewDate, interviewTime, staffNo, roomNo) The relation has the following functional dependencies: Fd1: clientNo, interviewDate interviewTime, staffNo, roomNo Fd2: staffNo, interviewDate, interviewTime clientNo Fd3: roomNo, interviewDate, interviewTime staffNo, clientNo Fd4: staffNo, interviewDate roomNo The determinants in Fd1, Fd2 and Fd3 are candidate keys but Fd4 is not. This means the relation is not in BCNF. As a consequence the relation may suffer from update anomalies. For example, to change the roomNo for staff SG5 on the 13-May-05 we must update two rows otherwise we will have inconsistency in the table.

32 BCNF - Example To transform the relation to BCNF we must remove the violating functional dependency by splitting the original relation into two new relations: Interview (clientNo, interviewDate, interviewTime, staffNo) StaffRoom (staffNo, interviewDate, roomNo) Note: in creating these 2 BCNF relations we have lost Fd3, as the determinant for this dependency is no longer in the same relation. The decision of whether to stop at 3NF or BCNF is dependent on the amount of redundancy resulting from the presence of Fd4 and the significance of the loss of Fd3.

33 Fourth Normal Form (4NF) MVD: Dependency between attributes (for example, A, B, and C) in a relation, such that for each value of A there is a set of values for B and a set of values for C. However, set of values for B and C are independent of each other: A B A C Possible existence of MVDs in a relation is due to 1NF and can result in data redundancy.

34 Fourth Normal Form (4NF) MVD can be trivial or nontrivial. –MVD A B in relation R is defined as being trivial if (a) B is a subset of A or (b) A B = R. –MVD is defined as being nontrivial if neither (a) nor (b) are satisfied. –Trivial MVD does not specify a constraint on a relation, while a nontrivial MVD does specify a constraint.

35 Fourth Normal Form (4NF) 4NF: a relation that is in BCNF and contains no nontrivial MVDs. The normalisation involves the removal of the MVD from the relation and placing the attribute(s) in a new relation along with a copy of the determinant(s).

36 4NF - Example