Entity Relationship Modelling

Similar documents
Data Analysis 1. Chapter 2.1 V3.1. Napier University Dr Gordon Russell

Chapter 4. In this chapter, you will learn:

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 4 Entity Relationship (ER) Modeling

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 4 Entity Relationship (ER) Modeling

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

DATABASE SYSTEMS. Chapter 5 Entity Relationship (ER) Modelling DESIGN IMPLEMENTATION AND MANAGEMENT INTERNATIONAL EDITION ROB CORONEL CROCKETT

LECTURE 3: ENTITY-RELATIONSHIP MODELING

Relational Model (cont d) & Entity Relational Model. Lecture 2

A l Ain University Of Science and Technology

Chapter # 4 Entity Relationship (ER) Modeling

Non-overlappingoverlapping. Final outcome of the worked example On pages R&C pages R&C page 157 Fig 3.52

Database Systems. Overview - important points. Lecture 5. Some introductory information ERD diagrams Normalization Other stuff 08/03/2015

COMP102: Introduction to Databases, 9.1

Represent entities and relations with diagrams

A l Ain University Of Science and Technology

Agenda: Understanding Relationship Types Degree and Cardinality with Examples

Chapter 2 Conceptual Modeling. Objectives

Lecture3: Data Modeling Using the Entity-Relationship Model.

Conceptual Database Design. COSC 304 Introduction to Database Systems. Entity-Relationship Modeling. Entity-Relationship Modeling

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 7 Data Modeling with Entity Relationship Diagrams

System Analysis And Design Methods ENTITY RELATIONSHIP DIAGRAM (ERD) Prof. Ali Khaleghi Eng. Hadi Haedar

Entity Relationship Diagram (ERD): Basics

ER modeling. Lecture 4


Objectives Definition iti of terms Importance of data modeling Write good names and definitions for entities, relationships, and attributes Distinguis

course 3 Levels of Database Design CSCI 403 Database Management Mines Courses ERD Attributes Entities title 9/26/2018

1/24/2012. Chapter 7 Outline. Chapter 7 Outline (cont d.) CS 440: Database Management Systems

Chapter 4 Entity Relationship Modeling In this chapter, you will learn:

Database Management System 6 ER Modeling...

IS 263 Database Concepts

Unit 2 - Data Modeling. Pratian Technologies (India) Pvt. Ltd.

Objectives of logical design... Transforming the ERD diagram into relations. Relational database components. Mapping a composite attribute

SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay. Lecture #10 Process Modelling DFD, Function Decomp (Part 2)

Chapter 12. Entity-Relationship Modeling

COSC 304 Introduction to Database Systems. Entity-Relationship Modeling

CSC 261/461 Database Systems Lecture 6. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101

David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation

Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys

Entity Relationship Data Model. Slides by: Shree Jaswal

CSC 261/461 Database Systems Lecture 7

Chapter 3 Database Modeling and Design II. Database Modeling

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

Conceptual Database Design (ER modeling) Chapter Three

Chapter 2: Entity-Relationship Model. Entity Sets. Entity Sets customer and loan. Attributes. Relationship Sets. A database can be modeled as:

MIS Database Systems Entity-Relationship Model.

Data Modeling Using the Entity-Relationship (ER) Model

Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts

Full file at

Essentials of Database Management (Hoffer et al.) Chapter 2 Modeling Data in the Organization

Copyright 2016 Ramez Elmasr and Shamkant B. Navathei

The Entity Relationship Model

Conceptual Data Modeling and the Entity- Relationship Model. Department of Computer Science Northern Illinois University September 2014

COMP 244. Entity Relationship Model Basics. Entity-Relationship Models. Key elements of the E-R model DATABASE CONCEPTS & APPLICATIONS

MIS2502: Data Analytics Relational Data Modeling - 1. JaeHwuen Jung

2. DatabaseDesign. Master I Software Engineering. Dr. Imed Bouchrika Dept of Mathematics & Computer Science University of Souk-Ahras

Related download: Instructor Manual for Modern Database Management 12th Edition by Hoffer Venkataraman Topi (Case studies included)

Intro to DB CHAPTER 6

ER DIAGRAM ER) diagram, a graphical representation of entities and their relationships to each other, typically used in computing in regard to the

Data Modeling During System Analysis. Logical Data Model Stages. What is Conceptual Database Design? Gathering Information for Conceptual

4. Entity Relationship Model

More on the Chen Notation

Entity-Relationship Model

LAB 2 Notes. Conceptual Design ER. Logical DB Design (relational) Schema Refinement. Physical DD

Overview of Database Design Process. Data Modeling Using the Entity- Relationship (ER) Model. Two main activities:

Data Modeling with the Entity Relationship Model. CS157A Chris Pollett Sept. 7, 2005.

4 Data Modeling and the Entity-Relationship Model (cont.)

The Entity-Relationship Model. The Entity-Relationship model. The ER model. The Entity-Relationship model. E-R Model Constructs. E-R Model Constructs

Chapter Outline. Note 1. Overview of Database Design Process Example Database Application (COMPANY) ER Model Concepts

CS 146 Database Systems

Chapter 1: The Database Environment

COMP Instructor: Dimitris Papadias WWW page:

Database Applications (15-415)

ER Model. Objectives (2/2) Electricite Du Laos (EDL) Dr. Kanda Runapongsa Saikaew, Computer Engineering, KKU 1

Chapter 2 ENTITY RELATIONSHIP MODEL

CMP-3440 Database Systems

SOLUTIONS TO REVIEW QUESTIONS AND EXERCISES FOR PART 3 - DATABASE ANALYSIS AND DESIGN (CHAPTERS 10 15)

Full file at Chapter 2: Foundation Concepts

Entity Relationship Modeling. From Rob and Coronel (2004), Database Systems: Design, Implementation, and Management

Relational Database Systems 1

Conceptual Data Models for Database Design

Major components of ER diagram Practices

Conceptual Data Modeling

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1

Information Technology Audit & Cyber Security

2004 John Mylopoulos. The Entity-Relationship Model John Mylopoulos. The Entity-Relationship Model John Mylopoulos

Institute of Southern Punjab, Multan

Multiple Choice Questions

Chapter 6: Entity-Relationship Model

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam

Chapter 2. Database Design. Database Systems p. 25/540

System Analysis & design

The Entity/Relationship (E/R) Model & DB Design. csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018

Entity Relationship Diagram (ERD) Dr. Moustafa Elazhary

Lecture 14 of 42. E-R Diagrams, UML Notes: PS3 Notes, E-R Design. Thursday, 15 Feb 2007

Entity-Relationship Model. From Chapter 5, Kroenke book

Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques. Fundamentals, Design, and Implementation, 9/e

IMS1002/CSE1205 Lectures 1

Modern Systems Analysis and Design Seventh Edition

Introduction to modeling. ER modelling

Database Design Using E/R Model

Transcription:

Entity Relationship Modelling Overview Database Analysis Life Cycle Components of an Entity Relationship Diagram What is a relationship? Entities, attributes, and relationships in a system The degree of a relationship Construct an Entity Relationship Diagram Unit 2.1 - Data Analysis / Slide 1 Dr G. Russell / 15 Feb 2000 09:51

DB Analysis Life Cycle Database initial study Database design Implementation and loading Testing and evaluation Operation maintenance and evolution Unit 2.1 - Data Analysis / Slide 2 Dr G. Russell / 15 Feb 2000 09:51

Database Analysis Life Cycle Database Initial study Analyse the company situation Define problems and constrains Define objectives Define scope and boundaries Database Design Create the conceptual design Create the logical design Create the physical design Implementation and loading Install the DBMS and create the database(s) Load or convert the data Unit 2.1 - Data Analysis / Slide 3 Dr G. Russell / 15 Feb 2000 09:51

Analysis Life Cycle continued... Testing and evaluation Test the database Fine-tune the database Evaluate the database and its application programs Operation Produce the required information flow Maintenance and evolution Introduce changes Make enhancements Unit 2.1 - Data Analysis / Slide 4 Dr G. Russell / 15 Feb 2000 09:51

Database Design Mini World View Requirements Collection and Analysis Conceptual Design Data Model Mapping Physical Design Unit 2.1 - Data Analysis / Slide 5 Dr G. Russell / 15 Feb 2000 09:51

Database Design Conceptual Design Entity Relationship modelling and normalisation Data model verification DBMS software selection Data Model Mapping Logical design Translate conceptual model into definitions for tables, views... Physical design Storage structures and access paths - optimize performance Distributed database design Unit 2.1 - Data Analysis / Slide 6 Dr G. Russell / 15 Feb 2000 09:51

Entity Relationship Modelling Entity Relationship (ER) modelling is a design tool is a graphical representation of the database system provides a high-level conceptual data model supports the user s perception of the data is DBMS and hardware independent had many variants is composed of entities, attributes, and relationships Unit 2.1 - Data Analysis / Slide 7 Dr G. Russell / 15 Feb 2000 09:51

Entities An entity is any object in the system that we want to model and store information about Individual objects are called entities Groups of the same type of objects are called entity types or entity sets Entities are represented by rectangles (either with round or square corners) Lecturer Chen s notation Lecturer other notations There are two types of entities; weak and strong entity types. Unit 2.1 - Data Analysis / Slide 8 Dr G. Russell / 15 Feb 2000 09:51

Attribute All the data relating to an entity is held in its attributes. An attribute is a property of an entity. Each attribute can have any value from its domain. Each entity within an entity type: May have any number of attributes. Can have different attribute values than that in any other entity. Have the same number of attributes. Unit 2.1 - Data Analysis / Slide 9 Dr G. Russell / 15 Feb 2000 09:51

Attribute cont... Attributes can be simple or composite single-valued or multi-valued Attributes can be shown on ER models They appear inside ovals and are attached to their entity. Note that entity types can have a large number of attributes... If all are shown then the diagrams would be confusing. Only show an attribute if it adds information to the ER diagram, or clarifies a point. Lecturer Name Unit 2.1 - Data Analysis / Slide 10 Dr G. Russell / 15 Feb 2000 09:51

Keys A key is a data item that allows us to uniquely identify individual occurrences or an entity type. A candidate key is an attribute or set of attributes that uniquely identifies individual occurrences or an entity type. An entity type may have one or more possible candidate keys, the one which is selected is known as the primary key. A composite key is a candidate key that consists of two or more attributes The name of each primary key attribute is underlined. Unit 2.1 - Data Analysis / Slide 11 Dr G. Russell / 15 Feb 2000 09:51

Relationships A relationship type is a meaningful association between entity types A relationship is an association of entities where the association includes one entity from each participating entity type. Relationship types are represented on the ER diagram by a series of lines. As always, there are many notations in use today... Unit 2.1 - Data Analysis / Slide 12 Dr G. Russell / 15 Feb 2000 09:51

Relationships cont... In the original Chen notation, the relationship is placed inside a diamond, e.g. managers manage employees: Manager manages Employee For this module, we will use an alternative notation, where the relationship is a label on the line. The meaning is identical Manager manages Employee Unit 2.1 - Data Analysis / Slide 13 Dr G. Russell / 15 Feb 2000 09:51

Degree of a Relationship The number of participating entities in a relationship is known as the degree of the relationship. If there are two entity types involved it is a binary relationship type Manager manages Employee If there are three entity types involved it is a ternary relationship type Sales Assistant sells Product Customer Unit 2.1 - Data Analysis / Slide 14 Dr G. Russell / 15 Feb 2000 09:51

Degree of a Relationship cont... It is possible to have a n-ary relationship (e.g. quaternary or unary). Unary relationships are also known as a recursive relationship. Employee manages It is a relationship where the same entity participates more than once in different roles. In the example above we are saying that employees are managed by employees. If we wanted more information about who manages whom, we could introduce a second entity type called manager. Unit 2.1 - Data Analysis / Slide 15 Dr G. Russell / 15 Feb 2000 09:51

Degree of a Relationship It is also possible to have entities associated through two or more distinct relationships. Department manages employs Employee In the representation we use it is not possible to have attributes as part of a relationship. To support this other entity types need to be developed. Unit 2.1 - Data Analysis / Slide 16 Dr G. Russell / 15 Feb 2000 09:51

Replacing ternary relationships When ternary relationships occurs in an ER model they should always be removed before finishing the model. Sometimes the relationships can be replaced by a series of binary relationships that link pairs of the original ternary relationship. Sales Assistant assists sells Customer Product buys This can result in the loss of some information - It is no longer clear which sales assistant sold a customer a particular product. Try replacing the ternary relationship with an entity type and a set of binary relationships. Unit 2.1 - Data Analysis / Slide 17 Dr G. Russell / 15 Feb 2000 09:51

Replacing Ternary relationships cont... Relationships are usually verbs, so name the new entity type by the relationship verb rewritten as a noun. The relationship sells can become the entity type sale. Sales Assistant makes Sale involves Product requests Customer So a sales assistant can be linked to a specific customer and both of them to the sale of a particular product. This process also works for higher order relationships. Unit 2.1 - Data Analysis / Slide 18 Dr G. Russell / 15 Feb 2000 09:51

Cardinality Most relationships are not one-to-one For example, a manager usually manages more than one employee This is described by the cardinality of the relationship, for which there are four possible categories. One to one (1:1) relationship One to many (1:m) relationship Many to one (m:1) relationship Many to many (m:n) relationship On an ER diagram, if the end of a relationship is straight, it represents 1, while a "crow s foot" end represents many. Unit 2.1 - Data Analysis / Slide 19 Dr G. Russell / 15 Feb 2000 09:51

Cardinality cont... A one to one relationship - a man can only marry one woman, and a woman can only marry one man, so it is a one to one (1:1) relationship Man 1 is married to 1 Woman A one to may relationship - one manager manages many employees, but each employee only has one manager, so it is a one to many (1:n) relationship Manager 1 manages m Employee Unit 2.1 - Data Analysis / Slide 20 Dr G. Russell / 15 Feb 2000 09:51

Cardinality cont... A many to one relationship - many students study one course. They do not study more than one course, so it is a many to one (m:1) relationship Student m studies 1 Course A many to many relationship - One lecturer teaches many students and a student is taught by many lecturers, so it is a many to many (m:n) relationship Lecturer m teaches n Student Unit 2.1 - Data Analysis / Slide 21 Dr G. Russell / 15 Feb 2000 09:51

Optionality A relationship can be option or mandatory. If the relationship is mandatory an entity at one end of the relationship must be related to an entity at the other end. The optionality can be different at each end of the relationship For example, a student must be on a course. This is mandatory. To the relationship student studies course is mandatory. But a course can exist before any students have enrolled. Thus the relationship course is_studied_by student is optional. To show optionality, put a circle or 0 at the optional end of the relationship. Unit 2.1 - Data Analysis / Slide 22 Dr G. Russell / 15 Feb 2000 09:51

Optionality cont... As the optional relationship is course is_studied_by student, and the optional part of this is the student, then the O goes at the student end of the relationship connection. Course is studied by 0 Student It is important to know the optionality because you must ensure that whenever you create a new entity it has the required mandatory links. Unit 2.1 - Data Analysis / Slide 23 Dr G. Russell / 15 Feb 2000 09:51

Entity Sets Sometimes it is useful to try out various examples of entities from an ER model. One reason for this is to confirm the correct cardinality and optionality of a relationship. We use an entity set diagram to show entity examples graphically. Consider the example of course is_studied_by student. BSc Comp MSc Biology BA Fine Art BSc Maths Examples of the "Course" entities the "is_studied_by" relationship Paul Jenny Sarah Andy Jim Anne Examples of the "Student" entities Unit 2.1 - Data Analysis / Slide 24 Dr G. Russell / 15 Feb 2000 09:51

Confirming Correctness BSc Comp MSc Biology BA Fine Art BSc Maths Examples of the "Course" entities the "is_studied_by" relationship Paul Jenny Sarah Andy Jim Anne Examples of the "Student" entities Use the diagram to show all possible relationship scenarios. Go back to the requirements specification and check to see if they are allowed. If not, then put a cross through the forbidden relationships This allows you to show the cardinality and optionality of the relationship Unit 2.1 - Data Analysis / Slide 25 Dr G. Russell / 15 Feb 2000 09:51

Deriving the relationship parameters To check we have the correct parameters (sometimes also known as the degree) of a relationship, ask two questions: One course is studied by how many students? Answer => zero or more. This gives us the degree at the student end. The answer zero or more needs to be split into two parts. The more part means that the cardinality is many. The zero part means that the relationship is optional. If the answer was one or more, then the relationship would be mandatory. Unit 2.1 - Data Analysis / Slide 26 Dr G. Russell / 15 Feb 2000 09:51

Relationship parameters cont... 2. One student studies how many courses? Answer => One This gives us the degree at the course end of the relationship. The answer one means that the cardinality of this relationship is 1, and is mandatory If the answer had been zero or one, then the cardinality of the relationship would have been 1, and be optional. Unit 2.1 - Data Analysis / Slide 27 Dr G. Russell / 15 Feb 2000 09:51

Redundant relationships Some ER diagrams end up with a relationship loop. check to see if it is possible to break the loop without losing info Given three entities A, B, C, where there are relations A-B, B-C, and C-A, check if it is possible to navigate between A and C via B. If it is possible, then A-C was a redundant relationship. Always check carefully for ways to simplify your ER diagram. It makes it easier to read the remaining information. Unit 2.1 - Data Analysis / Slide 28 Dr G. Russell / 15 Feb 2000 09:51

Redundant relationships example Consider entities customer (customer details), address (the address of a customer) and distance (distance from the company to the customer address). Customer far from work is living at Distance Address far from work Unit 2.1 - Data Analysis / Slide 29 Dr G. Russell / 15 Feb 2000 09:51

Splitting n:m Relationships A many to many relationship in an ER model is not necessarily incorrect. They can be replaced using an intermediate entity. This should only be done where: the m:n relationship hides an entity the resulting ER diagram is easier to understand. Unit 2.1 - Data Analysis / Slide 30 Dr G. Russell / 15 Feb 2000 09:51

Splitting n:m Relationships - Example Consider the case of a car hire company. Customers hire cars, one customer hires many card and a car is hired by many customers. Customer m hire n Car The many to many relationship can be broken down to reveal a hire entity, which contains an attribute date of hire. Customer m Hire n Car Unit 2.1 - Data Analysis / Slide 31 Dr G. Russell / 15 Feb 2000 09:51

Constructing an ER model - Entities Before beginning to draw the ER model, read the requirements specification carefully. Document any assumptions you need to make. 1. Identify entities - list all potential entity types. These are the object of interest in the system. It is better to put too many entities in at this stage and them discard them later if necessary. 2. Remove duplicate entities - Ensure that they really separate entity types or just two names for the same thing. Also do not include the system as an entity type e.g. if modelling a library, the entity types might be books, borrowers, etc. The library is the system, thus should not be an entity type. Unit 2.1 - Data Analysis / Slide 32 Dr G. Russell / 15 Feb 2000 09:51

Constructing an ER model - Attributes 3. List the attributes of each entity (all properties to describe the entity which are relevant to the application). Ensure that the entity types are really needed. are any of them just attributes of another entity type? if so keep them as attributes and cross them off the entity list. Do not have attributes of one entity as attributes of another entity! 4. Mark the primary keys. Which attributes uniquely identify instances of that entity type? This may not be possible for some weak entities. Unit 2.1 - Data Analysis / Slide 33 Dr G. Russell / 15 Feb 2000 09:51

Constructing an ER model - Relationships 5. Define the relationships Examine each entity type to see its relationship to the others. 6. Describe the cardinality and optionality of the relationships Examine the constraints between participating entities. 7. Remove redundant relationships Examine the ER model for redundant relationships. ER modelling is an iterative process, so draw several versions, refining each one until you are happy with it. Note that there is no one right answer to the problem, but some solutions are better than others! Unit 2.1 - Data Analysis / Slide 34 Dr G. Russell / 15 Feb 2000 09:51