ER Diagrams ● Many different notations are available ● From wikipedia:wikipedia: Entity-relationship modelwikipedia: Entity-relationship model ● How do.

Slides:



Advertisements
Similar presentations
IT420: Database Management and Organization
Advertisements

Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 3 The Entity- Relationship Model.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 5-1 COS 346 Day 6.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 5-1 David M. Kroenke Database Processing Tenth Edition Chapter 5 Data.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 3 The Entity- Relationship Model.
Fundamentals, Design, and Implementation, 9/e COS 346 Day 2.
Chapter 2: Entity-Relationship Model (Continued)
Entity-Relationship (E-R) Model
Chapter 41 Enhanced Entity-Relationship and Object Modeling.
Ch5: ER Diagrams - Part 2 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 5-1 David M. Kroenke’s Chapter Five: Data Modeling with the Entity-Relationship.
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Conceptual Design Lecture - 2 Database Development.
Chapter 5 Entity–Relationship Modeling
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 8 Slide 1 Chapter 9 Structuring System Data Requirements.
Entity Relationship Modeling
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 2/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 15: Object-Oriented Data Modeling Modern Database Management 9 h Edition Jeffrey A.
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
Databases : Data Modeling 2007, Fall Pusan National University Ki-Joune Li.
1 A Demo of Logical Database Design. 2 Aim of the demo To develop an understanding of the logical view of data and the importance of the relational model.
Enhanced Entity-Relationship (EER) Modeling. Slide 4- 2 Chapter Outline EER stands for Enhanced ER or Extended ER EER Model Concepts Includes all modeling.
Entity Relationship Modeling
Chapter 4 Extended Entity-Relationship (EER)Model Incorporates Set-subset Relationships Incorporates Generalization Hierarchies Constraints: Coverage Constraints:
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 4- 1.
ENTITY-RELATIONSHIP MODELLING. Objectives: How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated with ER model.
1 Database Design Entity-Relationship Modeling N. Ilayaraja PSG Tech.
Chapter 3: Modeling Data in the Organization
Data Modeling Using the Entity- Relationship (ER) Model
COP Introduction to Database Structures
Modeling data in the Organization
Comp 1100 Entity-Relationship (ER) Model
CSE202 Database Management Systems
Data Modeling Using the ERD
Enhanced Entity-Relationship and Object Modeling Objectives
Conceptual Design & ERD Modelling
Enhanced Entity-Relationship and UML Modeling
Entity-Relationship Model
Tables and Their Characteristics
Chapter 7: Entity-Relationship Model
Entity-Relationship Modelling
Chapter 7 Entity-Relationship Model
Outline of the ER Model By S.Saha
Entity-Relationship Modeling
IDEF1X Standard IDEF1X (Integrated Definition 1, Extended) was announced as a national standard in 1993 It defines entities, relationships, and attributes.
UML UML Data Modeling.
Chapter 18: Refining Analysis Relationships
Overview of Entity‐Relationship Model
Lec 3: Object-Oriented Data Modeling
Software Engineering Lecture #11.
Module 8 – Database Design Using the E-R Model
Entity-Relationship Modeling
UML Class Diagram.
Entity-Relation Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter 20 Object-Oriented Analysis and Design
Entity-Relationship Modelling
Database Systems Instructor Name: Lecture-9.
Chapter 7: Entity-Relationship Model
Database Processing: David M. Kroenke’s Chapter Five:
Weak Entities (cont…) Entities that do not have key attributes of their own Related to specific entities from another entity type plus their own attributes.
Enhanced Entity-Relationship (EER) Modeling
Database Management system
Enhanced Entity-Relationship (EER) Modeling
Chapter 6b: Database Design Using the E-R Model
UML  UML stands for Unified Modeling Language. It is a standard which is mainly used for creating object- oriented, meaningful documentation models for.
Presentation transcript:

ER Diagrams ● Many different notations are available ● From wikipedia:wikipedia: Entity-relationship modelwikipedia: Entity-relationship model ● How do we decide which to use – Decided by organization – house style – Or constrained by software tools – Or choose the model that best supports communication

Examples: facts to model ● A student has one and only one computer ● Each person may own many cars but may own none ● Each car has at most one owner; each car must have an owner. ● Each student may take many modules but may take none; each module may be taken by many students, but may be taken by none.

Relationship Participation ● Mandatory (Total) participation – “Every employee has a car” – “Every car has an employee” ● Optional (Partial) participation – “An employee may have a car” – “A car may be assigned to an employee” – “A title may be stocked by a bookshop” – “A bookshop may stock a title”

Minimum and Maximum Cardinality ● Maximum cardinalities 1:1, 1:N, N:M; ● Mandatory participation means a minimum cardinality of 1 ● Optional participation means a minimum cardinality of 0 ● Specify the minimum and maximum cardinalities for each relationship

Always four numbers ● A relationship needs four numbers – 2 max and 2 min cardinalities ● Each entity has a maximum and a minimum participation constraint ● Clients often fail to tell us one or more – seems obvious? - not to developer – “Each car is allocated to one employee” ● Must all cars be allocated?

UML ● Unified Modelling Language – More recent development – Well backed – Result of much experience over many years ● Can model for many different target systems – We use it throughout our courses – Which can be an advantage – but take care; the target system matters!

UML Class ● Class – The most common UML classifier – Can describe a kind of object in any kind of system; can describe an entity class – Represented as a rectangle with compartments ● Class in a class diagram – Rectangle with compartments: name, attributes, operations – We won't be using operations for ER modelling

UML Associations ● Association is a connection between classes ● Represents a semantic connection between objects ● We will use it to represent relationships between entity classes ● And don't leave out the multiplicity constraints!

Multiplicity Constraints ● Multiplicity tells how many objects are linked; it is used to show minimum and maximum cardinalities ● Expressed as 0..1, 0..*, 1..1, 1..* etc. ● Short versions: 1 for 1..1, * for 0..* ● Default is 1, standing for 1..1 ● Short versions and defaults lead to misunderstandings and are discouraged.

A 1:1 example ● “each student ‘has’ at most 1 computer, and at least 1 computer” ● ”for each computer there is at most one student, and there may be no student” ● read diagram as “a student has 1 and only 1 computer” – to remember which end is which

A 1:M example ● “each person may own many cars, but may own none” ● “each car has at most one owner and every car must have an owner” UML uses * for many

An N:M example ● “each student may take many modules but may take none” ● “each module may be taken by many students but may be taken by none”

The wordings ● Practice using these readings to translate ER diagrams into the client’s language ● Each can be “said” either way round – max and min cardinalities can be re-phrased ● We are trying to find and be certain about four numbers

The numbers ● UML supports – one or two values – values are numbers or * – two values are separated by.. ● e.g. 0..* * ● We tend to use just 0, 1 and * ● The relational model does not support other cardinalities well ● You may want to emphasise the importance of non-standard cardinalities Match 0..*2..2 SoccerTeam * plays Player 11..*1..1 in 11..*1..1

Comments on ER Modelling ● Entities, relationships, cardinalities ● All must be sought, specified, refined ● Similar to object modelling, – but we know we are going in a different direction with the implementation

Additional ER concepts ● Weak entities ● Subtypes

Weak Entities ● You may identify an entity whose instances cannot exist without a corresponding instance of another entity ● NextOfKin in an employees DB – when employee leaves, we delete the record ● Many notations round the corners on the entity box

UML Notation ● We must know one Next of Kin for each member of staff – Composition aggregation – Special case of UML association ● When the member of staff leaves, we want to “forget about” the associated next of kin 1.1 isKnownBy isKnownTo has NextOfKinEmployee

Subtypes ● Specialisation/generalisation ● Natural part of our thinking now ● Can be represented fairly well in the relational model ● Newer RDBMS concepts support them directly ● Good part of modelling – worth doing even if implementation were hard

“Cardinality” in subtyping ● Can think of – maximum subtyping of an instance ● (can it be subtyped more than once?) – minimum subtyping ● (must it be subtyped at least once?) – Use 0, 1, N etc. ● Really is “participation” ● Mandatory/Optional – must every instance be a member of a subclass? – c.f. abstract class ● Disjoint or not disjoint – must an instance be a member of only one subclass – can it be a member of >1

Two contrasting subtype scenarios Employee ClericalTechnicalManagerial Based on Kroenke Client NTUserUnixUserMainframeUser {incomplete, overlappingt} {complete,disjoint}

UML facilities ● Attributes can be added, with types etc. – may be able to label the PK (primary key) ● Later stage in the design – tools let you manage the attributes ● (other attribute notations are unwieldy) ● hiding and revealing are useful ● The object constraint language (OCL) expresses constraints in a way that enables tool support ● OCL is a specification language in its own right

UML facilities ● Operations in a class have no meaning – (for current generation RDBMS) – But this is changing ● Design can be structured (packages etc.) ● Can relate to documentation (hyperlinks?) ● “Notes” can say almost anything :-)

Tours and Operators ● A 'Whole Picture' example ● Tours and Operators (pdf) Tours and Operators (pdf)

“Reverse Engineered” ER

Constraints and Rules ● The E-R diagram should model, not dictate, the enterprise (business) rules, BUT ● Each binary relationship suggests four cardinality constraints – semantic information ● If not present in the rules, – rules are incomplete – open to ambiguous interpretation – consult, add, document !