Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1.

Slides:



Advertisements
Similar presentations
BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
Advertisements

ENTITY RELATIONSHIP MODELLING
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Modeling the Data: Conceptual and Logical Data Modeling
Concepts of Database Management Sixth Edition
Chapter 6 Methodology Logical Database Design for the Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Databases Revision.
Entity-Relationship Model and Diagrams (continued)
Methodology Logical Database Design for the Relational Model
Database Design Chapter 2. Goal of all Information Systems  To add value –Reduce costs –Increase sales or revenue –Provide a competitive advantage.
Slide 1 Chapter 05 – Part 1 Data Modeling with the Entity-Relationship Model.
WJEC Applied ICT Databases – Attributes & Entities Entities A database contains one or more related tables. Each table holds all of the information.
Database Relationships Objective 5.01 Understand database tables used in business.
Chapter 5 UNDERSTANDING AND DESIGNING ACCOUNTING DATA.
Database Relationships Objective 5.01 Understand database tables used in business.
Entity-Relationship modeling Transparencies
DATA MODELING AND DATABASE DESIGN DATA MODELING AND DATABASE DESIGN Part 1.
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Data Modeling and Relational Database Design. Analyze and model the relationships between entities Draw an initial entity relationship diagram Read the.
ICOM 5016 – Introduction to Database Systems Lecture 4 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Entity-relationship Modeling Transparencies 1. ©Pearson Education 2009 Objectives How to use ER modeling in database design. The basic concepts of an.
Structured Analysis Techniques
Database Design Concepts
2.3 Organising Data for Effective Retrieval
DATA MODELLING TOOLS FOR ORGANISING DATABASES. For a database to be organised and logical, it must be well-designed and set out. In such cases, the databases.
Database Systems Marcus Kaiser School of Computing Science Newcastle University.
CREATE THE DIFFERENCE Normalisation (special thanks to Janet Francis for this presentation)
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
Relational Database Concepts. Let’s start with a simple example of a database application Assume that you want to keep track of your clients’ names, addresses,
Relational DB Components
Entity Relationship Diagram (ERD) 22 February 2011.
Principles of Database Design, Part II AIMS 2710 R. Nakatsu.
Switch off your Mobiles Phones or Change Profile to Silent Mode.
Concepts and Terminology Introduction to Database.
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
Data Modelling. ICT5 Introduction Historical development with most organisations Small-scale origins Individual computers bought for particular applications.
Database Design Principles – Lecture 3
1 n 1 n 1 1 n n Schema for part of a business application relational database.
Database Design. Referential Integrity : data in a table that links to data in another table must always work in such a way that following the link will.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
1. Objectives At the end of this chapter you should be able to:  Discuss the use and features of a data model  Define the terms entity and attribute.
1 Entity-Relationship Diagram. 2 Components of ERD: –Entity –Relationship –Cardinality –Attributes.
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
IT 21103/41103 System Analysis & Design. Chapter 04 Data Modeling.
An Entity Relationship (ER) Diagram is a graphic that shows the interrelationship between entities in a database.
Description and exemplification of entity-relationship modelling.
ERD ( Conceptual data model From the statement of data requirements a conceptual data model is produced. This describes.
Jozef Kuper.  Describe a Database  Entities  Atributes  Relationships.
ENTITY RELATIONSHIP DIAGRAM ENTITY RELATIONSHIP DIAGRAM IS A SPECIALIZED GRAPHIC THAT ILLUSTRATES THE INTERRELATIONSHIPS BETWEEN ENTITIES IN A DATABASE.
Relational Theory and Design
Chapter 9 Logical Database Design : Mapping ER Model To Tables.
Database Design – Lecture 4 Conceptual Data Modeling.
Lesson 2: Designing a Database and Creating Tables.
Information Access Mgt09/12/971 Entity-Relationship Design Information Level Design.
Lecture 91 Introduction to Data Analysis and Logic Specification Objectives l Draw an entity-relationship diagram, and explain the types of entity relationships.
DBMS ER model-2 Week 6-7.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
Database Relationships Objective 5.01 Understand database tables used in business.
McGraw-Hill/Irwin Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Modeling the Data: Conceptual and Logical Data Modeling.
Teanna Clarke 6aQ What is a Entity-Relationship Diagram?  An Entity-Relationship Diagram (ERD) is a tool that graphically shows the connections among.
Data Modeling and Entity-Relationship Model I
ENTITY RELATIONSHIP DIAGRAM. Objectives Define terms related to entity relationship modeling, including entity, entity instances, attribute, relationship.
Rationale Databases are an integral part of an organization. Aspiring Database Developers should be able to efficiently design and implement databases.
G057 - Lecture 05 From Scenario To Design Mr C Johnston ICT Teacher
Database Relationships
Data Modelling Introduction
Entity relationship diagrams
Presentation transcript:

Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1

What is an Entity Relationship Diagram? Drawing technique used to analyse the logical structure of an organisations information (e.g. database). An entity is an object or concept about which the system needs to hold information eg Each entity must be involved in at least one relationship, and may be involved in more than one relationship. 2

Relationships What information will be kept in the system? The entities and their attributes. Eg of attributes For example, how do we represent a relationship between a book copy and a borrower in a library? Do we wish to say: “A book copy may be borrowed by only one borrower” or “A book copy may be borrowed by one or more borrowers” ? 3

Entity Relationship Diagram’s Pairs of entities are linked. All entities in the system relate directly or indirectly with all the others. How many relationships may exist between linked entities? This consideration is called multiplicity or cardinality. 4

Types of Relationships There are three ways that entities can be linked together: One-to-one One-to-many Many-to-many 5

One-to-One Relationship One occurrence of an entity ‘A’ is related to one and only one occurrence of the entity ‘B’ and One occurrence of an entity ‘B’ is related to one and only one occurrence of the entity ‘A’ 6

One-to-One continued There are two link phrases used on the relationship. Use the phrase ‘one and only one’ rather than ‘one’ to emphasise the cardinality existing at the both ends of this relationship. Consider joining the two entities. We might have one entity called School that would include all the attributes of the Head Teacher. This would have the advantage of reducing the number of entities. But it might make the model produced less clear. 7

One-to-Many Relationship One occurrence of an entity ‘A’ is linked to one or more occurrences of another entity ‘B’ and One occurrence of entity ‘B’ is linked to one and only one occurrence of entity ‘A’ 8

Many-to-Many Relationships One occurrence of an entity ‘A’ is linked to one or more occurrences of another entity ‘B’ and One occurrence of entity ‘B’ is linked to one or more occurrences of entity ‘A’ 9

Deciding on Relationships Which pairs of entities have a direct relationship? Looking out for verbs – ‘A stockholder of the company owns shares in that company’ Sometimes we might not want to include a direct relationship between two entities because an indirect relationship already exists - ‘Customer buys Products’ We may already have - ‘Customer places Order’ and ‘Order lists Products’ 10

The Problem with Many-to-Many 11

The Problem with Many-to-Many Project Code is included in the engineer table to provide a link between the two. What happens if an engineer works on two projects at the same time? We would need more than one value in the Project Code? (engineer ID51 works on both project W45 and Y65). Solution: form another table which links the two tables together. 12

Solving Many-to-Many Any engineer may be linked via an assignment table to a number of projects. Any project may have more than one engineer working on it. We need a link entity. Sometimes the name of this link entity is difficult to work out. 13

The Solution We now have 2 one-to-many relationships instead of 1 many-to-many relationship. 14

Mandatory and Optional Relationships In this case we interpret the relationship as: A School employs one or more Teachers. A Teacher is employed at one and only one School. 15

Mandatory and Optional Relationships Suppose some teachers are employed in more than one school - they may move around within an area and visit a number of schools. It is possible, that a teacher is not currently employed - that particular teacher would not participate in this relationship. 16

Mandatory and Optional Syntax A [name of entity] may / must ‘link phrase’ (one and only one) / (one or more) [name of entity] A School must employ many Teachers. A Teacher may be employed in one School. 17

Referential Integrity We insist on the mandatory part of the relationship between Order and Customer. We do not want an Order created which is not related to a particular Customer. This is known as referential integrity. All databases support this structure. 18

Referential Integrity When a user enters a new order it must relate to an existing customer. We cannot delete a customer for which there are existing orders. We can enter a customer without requiring an order to be related to that customer. 19

Attributes and Primary Keys You will assigned data types to attributes. You must created primary keys for tables. You can then link tables together. 20

Foreign Keys An Order may not be produced which is not related to an existing customer. Therefore, every time we enter a new order we must identify an existing Customer ID, so Customer ID would be a field on the Order table. This is called a Foreign key as Customer ID is a primary key on the Customer table. Foreign keys are identified by an asterisk * If we relaxed this condition and did not insist on referential integrity we would be allowed to enter no-value for this foreign key. Wherever possible we will endeavour to use referential integrity. 21

Entity Attribute Relationship Model  Select the entities.  Identify relationships between entities (including decisions about mandatory and optional relationships).  Resolve any many-to-many relationships.  List the entities with their attributes.  Identify suitable primary keys.  Place the required foreign keys in the detail entities. 22

Example – Steps 1 to 3 1. Select the entities. 2. Populate the entities with attributes. 3. Identify suitable primary keys. 23

Example – Steps 4 to 6 4. Identify relationships between entities. 5. Resolve any many-to-many relationships. 6. Place the required foreign keys in the detail entities. 24

Things to Note  Course ID is a foreign key on Course Offering table and Course ID is used as part of the primary key.  Employee Number is used as a foreign key on the Booking table.  Other foreign keys need to be included.  It is now possible to answer questions such as:  Who made this Booking?  Which Course Offering is this booking for?  Which Courses is a Staff Member booked to study? 25