Lecture 12: Entity Relationship Modelling



Similar documents
XV. The Entity-Relationship Model

IV. The (Extended) Entity-Relationship Model

Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model

Database Management Systems

Database Design Overview. Conceptual Design ER Model. Entities and Entity Sets. Entity Set Representation. Keys

THE ENTITY- RELATIONSHIP (ER) MODEL CHAPTER 7 (6/E) CHAPTER 3 (5/E)

Chapter 3. Data Modeling Using the Entity-Relationship (ER) Model

Chapter 2: Entity-Relationship Model. Entity Sets. " Example: specific person, company, event, plant

Database Design Process

2. Conceptual Modeling using the Entity-Relationship Model

COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model

Database Design Process

Data Analysis 1. SET08104 Database Systems. Napier University

Unit 2.1. Data Analysis 1 - V Data Analysis 1. Dr Gordon Russell, Napier University

Foundations of Information Management

The Entity-Relationship Model

not necessarily strictly sequential feedback loops exist, i.e. may need to revisit earlier stages during a later stage

ER modelling, Weak Entities, Class Hierarchies, Aggregation

CSC 742 Database Management Systems

Chapter 2: Entity-Relationship Model. E-R R Diagrams

Modern Systems Analysis and Design

Chapter 2: Entity-Relationship Model

Entity-Relationship Model

The Entity-Relationship Model

7.1 The Information system

Outline. Data Modeling. Conceptual Design. ER Model Basics: Entities. ER Model Basics: Relationships. Ternary Relationships. Yanlei Diao UMass Amherst

Data Modeling Basics

The Entity-Relationship Model

Foundations of Information Management

A brief overview of developing a conceptual data model as the first step in creating a relational database.

1 Class Diagrams and Entity Relationship Diagrams (ERD)

Conceptual Design Using the Entity-Relationship (ER) Model

Entity/Relationship Modelling. Database Systems Lecture 4 Natasha Alechina

Requirement Analysis & Conceptual Database Design. Problem analysis Entity Relationship notation Integrity constraints Generalization

DATABASE DESIGN. - Developing database and information systems is performed using a development lifecycle, which consists of a series of steps.

How To Write A Diagram

Data Modeling. Database Systems: The Complete Book Ch ,

Lesson 8: Introduction to Databases E-R Data Modeling

Lecture Notes INFORMATION RESOURCES

The Relational Model. Why Study the Relational Model? Relational Database: Definitions. Chapter 3

Converting E-R Diagrams to Relational Model. Winter Lecture 17

Databases Model the Real World. The Entity- Relationship Model. Conceptual Design. Steps in Database Design. ER Model Basics. ER Model Basics (Contd.

IT2305 Database Systems I (Compulsory)

Database Design Methodology

Databases and BigData

Developing Entity Relationship Diagrams (ERDs)

Lecture 6. SQL, Logical DB Design

DATABASE MANAGEMENT SYSTEMS. Question Bank:

The Relational Model. Ramakrishnan&Gehrke, Chapter 3 CS4320 1

Data Modeling: Part 1. Entity Relationship (ER) Model

Database Fundamentals: 1

Concepts of Database Management Seventh Edition. Chapter 6 Database Design 2: Design Method

Designing a Database Schema

Conceptual Design: Entity Relationship Models. Objectives. Overview

Entity Relationship Diagram

The E-R èentity-relationshipè data model views the real world as a set of basic objects èentitiesè and

Review: Participation Constraints

Database IST400/600. Jian Qin. A collection of data? A computer system? Everything you collected for your group project?

Entity - Relationship Modelling

Announcements. SE 1: Software Requirements Specification and Analysis. Review: Use Case Descriptions

Relational Schema Design

Lectures 2 & 3: Introduction to Modeling & UML. Getting started

Mathematics for Computer Science/Software Engineering. Notes for the course MSM1F3 Dr. R. A. Wilson

Entity-Relationship Model. Purpose of E/R Model. Entity Sets

Using UML Part One Structural Modeling Diagrams

Hotel Management System

Database Design Process. Databases - Entity-Relationship Modelling. Requirements Analysis. Database Design

A Comparative Analysis of Entity-Relationship Diagrams 1

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

three Entity-Relationship Modeling chapter OVERVIEW CHAPTER

SCHEMAS AND STATE OF THE DATABASE

We know how to query a database using SQL. A set of tables and their schemas are given Data are properly loaded

Database Design. Database Design I: The Entity-Relationship Model. Entity Type (con t) Chapter 4. Entity: an object that is involved in the enterprise

Lecture 9: Requirements Modelling

Introduction to Computing. Lectured by: Dr. Pham Tran Vu

An analysis of structural validity in entity-relationship modeling

Designing Databases. Introduction

A Short Tutorial on Using Visio 2010 for Entity-Relationship Diagrams

IT2304: Database Systems 1 (DBS 1)

A Rational Software Whitepaper

UML: Classes -- Association

Modeling for Data and Business Rules

Bridge from Entity Relationship modeling to creating SQL databases, tables, & relations

SEARCH The National Consortium for Justice Information and Statistics. Model-driven Development of NIEM Information Exchange Package Documentation

Chapter 10 Practical Database Design Methodology and Use of UML Diagrams

BİL 354 Veritabanı Sistemleri. Entity-Relationship Model

DATABASE INTRODUCTION

Chapter 10 Practical Database Design Methodology and Use of UML Diagrams

Toad Data Modeler - Features Matrix

In this Lecture you will Learn: Systems Development Methodologies. Why Methodology? Why Methodology?

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #5: En-ty/Rela-onal Models- - - Part 1

Doing database design with MySQL

12 File and Database Concepts 13 File and Database Concepts A many-to-many relationship means that one record in a particular record type can be relat

Nearly every book, article, or presentation about FRBR has an explication THE ENTITY- RELATION MODEL SIX

Introduction to normalization. Introduction to normalization

Chapter 8 The Enhanced Entity- Relationship (EER) Model

Generating Enterprise Applications from Models

Chapter 2. Data Model. Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel

Unit 5: Object-Role Modeling (ORM)

Lecture 16 : Relations and Functions DRAFT

Transcription:

Lecture 12: Entity Relationship Modelling The Entity-Relationship Model Entities Relationships Attributes Constraining the instances Cardinalities Identifiers Generalization 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 1

The Entity Relationship Model Entity-Relationship Schema Describes data requirements for a new information system Direct, easy-to-understand graphical notation Translates readily to relational schema for database design But more abstract than relational schema E.g. can represent an entity without knowing its properties comparable to UML class diagrams Entities: classes of objects with properties in common and an autonomous existence E.g. City, Department, Employee, Purchase and Sale An instance of an entity is an object in the class represented by the entity E.g. Stockholm, Helsinki, are examples of instances of the entity City Relationships: logical links between two or more entities. E.g. Residence is a relationship that can exist between the City and Employee An instance of a relationship is an n-tuple of instances of entities E.g. the pair (Johanssen,Stockholm), is an instance in the relationship Residence. 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 2

Examples 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 3

Example Instances for Exam Exam 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 4

What Does An ER Diagram Really Mean? Course Meets Room Course and Room are entities. Their instances are particular courses (eg CSC340F) and rooms (eg MS2172) Meets is a relationship. Its instances describe particular meetings. Each meeting has exactly one associated course and room Course instances Meets instances Room instances 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 5

An entity can have relationships with itself Recursive Relationships If the relationship is not symmetric need to indicate the two roles that the entity plays in the relationship. 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 6

Ternary Relationships 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 7

AND/XOR Relationships Each Order either contains a part or requests a service, but not both For any given order, whenever there is at least one invoice there is also at least one shipment and vice versa 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 8

Attributes associates with each instance of an entity (or relationship) a value belonging to a set (the domain of the attribute). The domain determines the admissible values for the attribute. 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 9

Composite Attributes These group attributes of the same entity or relationship that have closely connected meanings or uses. 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 10

Schema with Attributes 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 11

Cardinalities Cardinalities constrain participation in relationships maximum and minimum number of relationship instances in which an entity instance can participate. E.g. cardinality is any pair of non-negative integers (a,b) such that a b. If a=0 then entity participation in a relationship is optional If a=1 then entity participation in a relationship is mandatory. If b=1 each instance of the entity is associated at most with a single instance of the relationship If b= N then each instance of the entity is associated with an arbitrary number of instances of the relationship. 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 12

Cardinality Example A A course meets twice a week Course (2,2) Meets (0,40) Room A A day can have an unlimited number of meetings Day (0,N) A A room can have up to 40 meetings per week 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 13

Instantiating ER diagrams An ER diagram specifies what states are possible in the world being modeled Course (2,2) (0,40) Meets Room Illegal Instantiations 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 14

Cardinalities of Attributes Attributes can also have cardinalities To describe the minimum and maximum number of values of the attribute associated with each instance of an entity or a relationship. The default is (1,1) Optional attributes have cardinality (0,1) Multi-valued attribute cardinalities are problematic Usually better modelled with additional entities linked by one-to-many (or manyto-many) relationships 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 15

Identifiers (also known as keys ) How to uniquely identify instances of an entity? An identifier may formed by one or more attributes of the entity itself If attributes of an entity are not sufficient to identify instances unambiguously, other entities can be involved in the identification A relationships is identified using identifiers for all the entities it relates E.g. the identifier for the relationship (Person-) Owns(-Car) is a combination of the Person and Car identifiers. internal, single-attribute external, multi-attribute internal, multi-attribute 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 16

Notes on Identifiers Identifiers and cardinality: An identifier can involve one or more attributes, provided that each has (1,1) cardinality An external identifier can involve one or more entities, provided that each is a member of a relationship to which the entity to identify participates with cardinality (1,1) Cycles An external identifier can involve an entity that is in its turn identified externally, as long as cycles are not generated; Multiple identifiers Each entity must have at least one (internal or external) identifier An entity can have more than one identifier Note: if there is more than one identifier, then the attributes and entities involved in an identification can be optional (minimum cardinality equal to 0). 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 17

Schema with Identifiers 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 18

Understanding Identifier Choices 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 19

Generalizations Show is-a relationships between entities Inheritance: Every instance of a child entity is also an instance of the parent entity Every property of the parent entity (attribute, identifier, relationship or other generalization) is also a property of a child entity 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 20

Total generalizations: Types of Generalizations every instance of the parent entity is an instance of one of its children Shown as a solid arrow (otherwise: Partial, shown as an unfilled arrow) Exclusive generalizations: every instance of the parent entity is at most an instance of one of its children (otherwise: overlapping) 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 21

The E-R Meta-Model (as an E-R Diagram) 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 22

Summary: UML vs ERD ER diagrams are similar to UML Class diagrams Class diagrams emphasize class hierarchies and operations ER diagrams emphasize relationships and identity But you only need one for any given problem analysis! ER provides richer notation for database concepts: ER diagrams allow N-ary relationships (UML Class diagrams only allow binary relationships) ER diagrams allow multi-valued attributes ER diagrams allow the specification of identifiers Choice may depend on implementation target: Class diagrams for Object Oriented Architecture ER diagrams for Relational Databases But this only matters if you are using them for blueprints For sketches, familiarity with notation is more important 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 23