Lesson III. Entity- Relationship Model

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

Data Analysis 1. SET08104 Database Systems. Napier University

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

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

Modern Systems Analysis and Design

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

three Entity-Relationship Modeling chapter OVERVIEW CHAPTER

Entity-Relationship Model

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

1 Class Diagrams and Entity Relationship Diagrams (ERD)

The Entity-Relationship Model

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

Entity/Relationship Modelling. Database Systems Lecture 4 Natasha Alechina

Foundations of Information Management

Conceptual Design: Entity Relationship Models. Objectives. Overview

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

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

Lecture 12: Entity Relationship Modelling

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

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

2. Conceptual Modeling using the Entity-Relationship Model

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

ER modelling, Weak Entities, Class Hierarchies, Aggregation

Why & How: Business Data Modelling. It should be a requirement of the job that business analysts document process AND data requirements

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

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

RELATIONSHIP STRENGTH

Lesson 8: Introduction to Databases E-R Data Modeling

Chapter 2: Entity-Relationship Model

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

EXTENDED LEARNING MODULE A

Entity Relationship Diagram

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

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

LOGICAL DATABASE DESIGN

Entity - Relationship Modelling

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

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

Chapter 3. Data Analysis and Diagramming

Foundations of Information Management

A Comparative Analysis of Entity-Relationship Diagrams 1

14 Databases. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

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

IV. The (Extended) Entity-Relationship Model

Designing Databases. Introduction

Relational Database Concepts

An Experimental Comparison of ER and UML Class Diagrams

XV. The Entity-Relationship Model

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

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

A technical discussion on modeling with UML 06/11/03 Entity Relationship Modeling with UML

Database Design Process

7.1 The Information system

The Entity-Relationship Model

Database Design Process


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

LAB 3: Introduction to Domain Modeling and Class Diagram

Overview. Essential Questions. Precalculus, Quarter 4, Unit 4.5 Build Arithmetic and Geometric Sequences and Series

MODULE 8 LOGICAL DATABASE DESIGN. Contents. 2. LEARNING UNIT 1 Entity-relationship(E-R) modelling of data elements of an application.

Animated Courseware Support for Teaching Database Design

Database Management Systems

Fundamentals of Database System

True. All that perfect systems need are correct programs.

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

Exercise 1: Relational Model

Data Modeling with Entity-Relationship Diagrams

Database Systems. Session 3 Main Theme. Enterprise Data Modeling Using The Entity/Relationship (ER) Model. Dr. Jean-Claude Franchitti

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

DATABASE INTRODUCTION

How to Make a Domain Model. Tutorial

Relational Data Analysis I

Unit 2 Module 3: Generating Examples and Nonexamples

æ A collection of interrelated and persistent data èusually referred to as the database èdbèè.

Lecture Notes INFORMATION RESOURCES

SOFTWARE ENGINEERING IT 0301 Semester V B.Nithya,G.Lakshmi Priya Asst Professor SRM University, Kattankulathur. School of Computing, Department of IT

Using Entity-Relationship Diagrams To Count Data Functions Ian Brown, CFPS Booz Allen Hamilton 8283 Greensboro Dr. McLean, VA USA

Fundamentals of Database Design

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

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

Instructional Systems Design

2. Supports ecient access to very large amounts. Example: bank and its ATM machines. from the same account via ATM machines

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

Using UML Part One Structural Modeling Diagrams

DIA Creating Charts and Diagrams

CHAPTER 6 DATABASE MANAGEMENT SYSTEMS. Learning Objectives

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

Database Design Methodology

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

Collated Food Requirements. Received orders. Resolved orders. 4 Check for discrepancies * Unmatched orders

CA IDMS. Database Design Guide. Release , 2nd Edition

Conceptual Design Using the Entity-Relationship (ER) Model

Geometry Solve real life and mathematical problems involving angle measure, area, surface area and volume.

Select the Crow s Foot entity relationship diagram (ERD) option. Create the entities and define their components.

Databases and BigData

Understanding Data Flow Diagrams Donald S. Le Vie, Jr.

GMAT.cz GMAT.cz KET (Key English Test) Preparating Course Syllabus

Math Content by Strand 1

Concepts of Database Management Eighth Edition. Chapter 1 Introduction to Database Management

Data Modeling. Database Systems: The Complete Book Ch ,

Transcription:

Lesson III Entity- Relationship Model

IN THIS LESSON YOU WILL LEARN What a ER diagram is (ERD) and what it is used for. To identify the main constructs in a ERD. To understand the difference between entities and entitytypes and how to represent them. Definition of attributes, types and their representation. The meaning of relationship between entities and its representation. Attributes in a relationship. Maximum and minimum cardinality, types and representation. 2

INTRODUCTION Entity-Relationship Model The entity-relationship model (ERM) is an abstract and conceptual representation of data. Diagrams created using this process are called entity-relationship diagrams (ERD). The ER modelling method was proposed by Peter Chen in 1976. 3

INTRODUCTION Entity-Relationship Model Graphical technique to model databases. Entity-Relationship Model It is based on a perception of a real world that consists of a collection of objects called entities and relationships among these objects. 4

ER DIAGRAMS (ERD) Example I 5

Why do we want to draw a model for a part of the real world?

ER DIAGRAMS (ERD) We ll start with the simplest version of ER and then extend it later on 7

ER DIAGRAMS (ERD) Main Constructs The basic ER notation uses three main constructs: data entities (entity-types) attributes relationships 8

ER DIAGRAMS (ERD) Exemple II entity attributes relationship 9

DATA ENTITY Definition Entities are the main objects of informational interest. A person, animal, place, object or event about which data is to be maintained. e.g. students, subjects, departments, meetings,... o Represents a set or collection of objects in the real world that share the same properties. 10

DATA ENTITY Entity Instance entity instances data entity 11

DATA ENTITY Entity Instance A particular occurrence of a data entity is called an entity instance or an entity occurrence. e.g. TEACHER is an entity. BUT Xavier Morera is an entity instance. 12

DATA ENTITY Representation An entity is represented by a rectangle with the name of the entity-type inside. STUDENT TEACHER SUBJECT DEPARTMENT The type of the entity must be written in singular! 13

ENTITY Data Entity vs Entity Instance Business entity 14 Modern languages Computing DEPARTMENT entity instances

DATA ENTITY Guideline for Naming Entities An entity type name is a singular noun. An entity type should be descriptive and specific. An entity name should be concise. Event entity types should be named for the result of the event, not the activity or process. 15

ATTRIBUTES Definition Named characteristics or properties of an entity-type. e.g. CAR number_plate, brand, price, speed... EMPLOYEE id, name, address, course... PRODUCT code, name, price... SALE number, amount, method_payment... Attributes can only take up a value at any particular point in time!! 16

ATTRIBUTES Definition An entity-type is described by a set of attributes that provide details about it. All entity instances of the same type have the same attributes!! 17

ATTRIBUTES Guideline for Naming Attributes An attribute name is a noun. An attribute name should be descriptive. An attribute name should be unique. Similar attributes of different entity types should use similar but distinguishing names. 18

ATTRIBUTES Representation Attributes can be denoted by an ellipse with the name of the property inside. 19

ATTRIBUTES Representation There s a simplier way to represent attributes. We ll use single lines to connect the entitity to its attributes. 20

Activity 3.1 Indentifying Entities and Attributes

Is this entitytype correct?

What s the difference between an entity and a table?

ATTRIBUTES Types There are two types of attributes: - descriptors - identifiers (or keys) 24

ATTRIBUTES Descriptors vs Keys o A descriptor is used to specify a nonunique characteristic of a particular entity instance. o An identifier (or key) is used to uniquely determine an instance of an entity. 25

KEY Definition A key is an attribute (or combination of attributes) that uniquely identifies each instance of an entity type. An entity-type has at least one key. Some entities may have more than one key. 26

KEY Definition 27 Which attribute/s make/s teachers different?

KEY Example key teacher with id= 34 descriptors 28

KEY Definition Some entities may have more than one key. key key 29

IDENTIFIER Definition A key that has been selected as the unique identifying characteristic for an entity type. identifier OR identifier 30

IDENTIFIER Examples e.g. An identifier for CAR may be number_plate An identifier for EMPLOYEE may be id An identifier for PRODUCT may be code An identifier for SALE may be number 31

How many identifiers can an entity have?

IDENTIFIER ATTRIBUTES To Take Into Account A unique identifier can be an attribute or a combination of attributes. Only one identifier has to be chosen for each entity. 33

IDENTIFIER ATTRIBUTES Representation Each attribute in the key is underlined in the ER diagram, as shown: identifier descriptors 34

Activity 3.2 Choosing Identifiers

Is an identifier a primary key in a table?

RELATIONSHIPS Definition Relationships represent real-world associations among instances of one or more entity-types. e.g. A TEACHER teaches SUBJECTS A teacher teaches subjects 37

RELATIONSHIPS Guideline for Naming Relationships Relationships name should be an active or a passive verb. teacher subjects A teacher teaches subjects. A subject is taught by teachers. 38

RELATIONSHIPS Visualization A relationship includes entity instances from each participating entity-type. teacher subjects 39

RELATIONSHIPS Visualization Xavi Database Joan Programming Encarna TEACHER teaches Networks SUBJECT 40

How many instances can be involved in a relationship?

RELATIONSHIPS Introduction to Cardinality teacher subjects A teacher teaches subjects. A subject can be taught by teachers. 42 How many??

RELATIONSHIPS Representation A relationship is depicted by a diamond on the line that joins the entitity-types together. 43

How many relationships may there be between two entities?

RELATIONSHIPS Example 45

ER DIAGRAMS (ERD) Indentifying the Objects An entity normally is the subject or the object in the sentence. e.g. A person has a car A person has a car Relationships are usually denoted by verbs. e.g. A person has a car 46

Activity 3.3 Identifying Relationships

How many entity-types can be involved in a relationship?

RELATIONSHIPS Degree Degree of a relationship is the number of entity types that participate in it. Binary: between two entity types. Ternary: among three entity types. Unary: between an entity type. Quaternary 49

RELATIONSHIPS Degree 50

Activity 3.4 Attributes and Relationships

RELATIONSHIPS Attributes 123, Steven, Barcelona,, 8 In what subject? 52

RELATIONSHIPS Attributes We want to know the grade that each student has got for each subject. Where do we have to put the attribute? 53

RELATIONSHIPS Attributes C3, Database analysis,,8 Of what student? 54

RELATIONSHIPS Attributes 123, Steven, gets an 8 in C3, DB 123, Steven, gets a 5 in C5, Programming.. 444, Karen, gets a 3 in C3, Programming 55

RELATIONSHIPS Attributes 12, Steve 12, Steven, 44, Karen, 3 8 5 Database Programming Networks 56 student enrols subject

Activity 3.5 The Vendors Database

THE VENDORS DATABASE 58

RELATIONSHIPS Cardinality It specifies maximum and minimum number of instances of an entity related to one instance of another entity. How many? 59 A teacher teaches subjects. A subject can be taught by teachers.

RELATIONSHIPS Cardinality Given a teacher... how many subjects? Given a subject... how many teachers? 60

RELATIONSHIPS Cardinality Xavi Database Joan Programming Encarna TEACHER teaches Networks SUBJECT 61

RELATIONSHIPS Cardinality There are two types of cardinality: Maximum cardinality (connectivity) Minimum cardinality 62

CARDINALITY Example given a teacher......how many subjects at most and how many at least? given a department......how many teachers at most and how many at least? 63

MAXIMUM CARDINALITY Definition It specifies the maximum number of instances of an entity related to one instance of another entity. one or many 64

MAXIMUM CARDINALITY Example Given a teacher... how many departments at most? oneor or many? Given a department... how many teachers at most? 65

MAXIMUM CARDINALITY Example many one Given a teacher... how many departments? Given a department... how many teachers? 66

MAXIMUM CARDINALITY To Remember The maximum cardinality is represented on the opposite side of the entity we are working with. one 67

MAXIMUM CARDINALITY ER Representation many N one 1 N 1 many one 68

MAXIMUM CARDINALITY Types According to its maximum cardinality, relationships can be classified as either. one to many 1:N many to many N:M one to one 1:1 69 Relational modeling ideal

MAXIMUM CARDINALITY Examples 70

Activity 3.6 Maximum Cardinality

Activity 3.7 Entities vs Attributes

MINIMUM CARDINALITY Definition It specifies the minimum number of instances of an entity related to one instance of another entity. one or none 73

MINIMUM CARDINALITY Example Given a teacher... how many departments at least? oneor or none? Given a department... how many teachers at least? 74

MINIMUM CARDINALITY To Remember The minimum cardinality is represented by the entity we are working with. one 75

MINIMUM CARDINALITY Example none one Given a teacher... how many departments? Given a department... how many teachers? 76

MINIMUM CARDINALITY ER Representation one double line none simple line none one 77

MINIMUM CARDINALITY Examples 78

MINIMUM CARDINALITY Existence Contraint / Mandatory existence constraint = TOTAL PARTICIPATION A department can t exist without an employee who manages it. 79

MINIMUM CARDINALITY Optional existence constraint Partial Participation (optional) Total Participation (mandatory) 80

CARDINALITY Representation II (max, min) e.g. given a teacher......how many subjects at most?...how many subjects at least? 81

Activity 3.8 Minimum Cardinality

CONSTRUCTING ERD Guidelines Before drawing the ER diagram, understand the requeriments. Identify all potential entity-types. Remove duplicate entities. -Do not include the system as an entity-type! List the attributtes of each entity. -Ensure that the entity types are really needed. -Do not have attributes of one entity as attributes of another entity! Mark the primary keys. Define the relationships. Describe the cardinality and optionality of the relationships. Remove redundant relationships. 83

Activity 3.9 Bank

Activity 3.10 Nursery

Activity 3.11 Garage

Activity 3.12 Model Agencies

HISTORICAL RECORDS What s the difference between both 88 diagrams?

Activity 3.13 General Elections