MIT Database Management Systems Lesson 03: Entity Relationship Diagrams

Similar documents
MIT Database Management Systems Lesson 03: ER-to-Relational Mapping

Database Management System 6 ER Modeling...

Database Management Systems MIT Lesson 01 - Introduction By S. Sabraz Nawaz

Advance Database Management System

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

LECTURE 3: ENTITY-RELATIONSHIP MODELING

Database Management Systems LECTURE NOTES 2

The Entity-Relationship Model. Overview of Database Design

The Entity-Relationship Model

Lecture3: Data Modeling Using the Entity-Relationship Model.

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

The Entity-Relationship Model. Steps in Database Design

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

MIT Database Management Systems Lesson 01: Introduction

Database Management Systems. Chapter 3 Part 2

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

Sahaj Computer Solutions. Data Modeling using the Entity Relationship Model

DATA MODELING USING THE ENTITY-RELATIONSHIP MODEL. 1 Powered by POeT Solvers Limited

Introduction to Databases

Entity Relationship Data Model. Slides by: Shree Jaswal

Conceptual Design. The Entity-Relationship (ER) Model

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

Review The Big Picture

CS 405G: Introduction to Database Systems

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

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

CSE 530A. ER Model. Washington University Fall 2013

Elements of the E-R Model

COMP102: Introduction to Databases, 9.1

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

Introduction to Database Design. Dr. Kanda Runapongsa Dept of Computer Engineering Khon Kaen University

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

The Entity-Relationship Model

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

Lesson 02 Data Types and Statements. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

The Entity-Relationship Model. Overview of Database Design. ER Model Basics. (Ramakrishnan&Gehrke, Chapter 2)

Contents. Database. Information Policy. C03. Entity Relationship Model WKU-IP-C03 Database / Entity Relationship Model

Chapter 2: Entity-Relationship Model

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

Data Modeling Using the Entity-Relationship (ER) Model

COMP Instructor: Dimitris Papadias WWW page:

MIS Database Systems Entity-Relationship Model.

Lesson 09 Working with. SDI and MDI. MIT 31043: Rapid Application Development By: S. Sabraz Nawaz Senior Lecturer in MIT Dept. of MIT, FMC, SEUSL

A database can be modeled as: + a collection of entities, + a set of relationships among entities.

Database Management Systems MIT Introduction By S. Sabraz Nawaz

The Entity-Relationship (ER) Model

Introduction to Database Design

Database Design. ER Model. Overview. Introduction to Database Design. UVic C SC 370. Database design can be divided in six major steps:

Database Systems. Lecture2:E-R model. Juan Huo( 霍娟 )

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

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

Database Management Systems,

Database Applications (15-415)

Chapter 12. Entity-Relationship Modeling

Overview. Introduction to Database Design. ER Model. Database Design

Definition. 02. Data Modeling. Example ABC Company Database. Data Modeling Importance

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

CONCEPTUAL DESIGN: ER TO RELATIONAL TO SQL

Entity-Relationship Models

The Entity-Relationship Model

Lecture 2: Entity Relationship Data Model 2. 1

Database Systems ER Model. A.R. Hurson 323 CS Building

Data Modeling. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke

CSE 880:Database Systems. ER Model and Relation Schemas

Overview of db design Requirement analysis Data to be stored Applications to be built Operations (most frequent) subject to performance requirement

Lesson 02 Data Types and Statements. MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

CSIT5300: Advanced Database Systems

Agenda: Understanding Relationship Types Degree and Cardinality with Examples

Copyright 2016 Ramez Elmasr and Shamkant B. Navathei

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

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

Database Management Systems. Chapter 2 Part 2

Data Modeling Using the Entity- Relationship Model Design & Analysis of Database Systems

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

Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the Bank Database Reduction to

CS2 Current Technologies Lecture 5: Data Modelling and Design

CS/INFO 330 Entity-Relationship Modeling. Announcements. Goals of This Lecture. Mirek Riedewald

Entity-Relationship Model

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

Chapter 6: Entity-Relationship Model

The Relational Model. Chapter 3. Database Management Systems, R. Ramakrishnan and J. Gehrke 1

Intro to DB CHAPTER 6

Chapter 2 Conceptual Modeling. Objectives

Introduction to Database Design

Chapter 17. Methodology Logical Database Design for the Relational Model

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

Lesson 05 Methods. MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

DATABASE DESIGN PROCESS

The Entity Relationship Model

Introduction to Database Design

Data Modeling Using the Entity-Relationship Model

CIS 330: Web-driven Web Applications. Lecture 2: Introduction to ER Modeling

Database Management System by

Lesson 06 Arrays. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

Chapter 6: Entity-Relationship Model

2. E-R Model. Entity Sets Relationship Sets Attributes

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

MIT Database Management Systems

Conceptual Data Modeling

Conceptual Data Modeling Using E-R Models. PM Jat

Transcription:

MIT 22033 Database Management Systems Lesson 03: Entity Relationship Diagrams By S. Sabraz Nawaz Senior Lecturer in MIT, FMC, SEUSL & A.J.M.Hasmy FMC, SEUSL

ER - Model The entity-relationship (ER) data model allows us to describe the data involved in a real-world enterprise in terms of objects and their relationships and is widely used to develop an initial database design MIT 22033, Database Management Systems By: S.Sabraz Nawaz 2

E-R Model (Entities) The two main constructs of the Entity- Relationship model are Entities & Relationships An entity is an object in the real world that is distinguishable from other objects o e.g. Lecturer, Student, Subject, etc. A collection of similar entities is called an entity set o e.g. Lecturers, Students, Subjects, etc. ENTITY MIT 22033, Database Management Systems By: S.Sabraz Nawaz 3

E-R Model (Entities...) Example, an employee in a company database. e1 e2 e3 e4 e5 e6 EMPLOYEES Employee Entity set MIT 22033, Database Management Systems By: S.Sabraz Nawaz 4

E-R Model (Attribute) An entity is described using a set of attributes o e.g. Name, NIC, etc. All entities in an entity set have the same attribute Attribute MIT 22033, Database Management Systems By: S.Sabraz Nawaz 5

E-R Model (Attributes ) salary dob Example: name, id, age & salary are attributes in EMPLOYEES entity e1 e2 e3 e4 e5 e6 name id Employee Entity set EMPLOYEES salary name dob MIT 22033, Database Management Systems By: S.Sabraz Nawaz 6 id

E-R Model (Attributes ) The attributes are said to be composite if they can be split. Eg:- the entity Employee contains attribute 'name' which is a composite one name EMPLOYEES LastName FirstName MIT 22033, Database Management Systems By: S.Sabraz Nawaz 7

E-R Model (Attributes ) A multi-valued attribute of an entity is one which has multiple values. o Eg:- attribute phone numbers in employee entity. EMPLOYEES surname first_name phone MIT 22033, Database Management Systems By: S.Sabraz Nawaz 8

E-R Model (Attributes ) Some attributes that can be computed from other attributes are called derived attributes. o Eg:- age is derived from date of birth & current date EMPLOYEES dob name age MIT 22033, Database Management Systems By: S.Sabraz Nawaz 9

E-R Model (Attributes another sample) Customers MIT 22033, Database Management Systems By: S.Sabraz Nawaz 10

E-R Model (Domain) Each attribute in an entity set has domain; possible values o e.g. Age attribute of an employee has possible integer values from 18-60 MIT 22033, Database Management Systems By: S.Sabraz Nawaz 11

E-R Model (Keys) A Key is a minimal set of attributes whose values uniquely identify an entity in the set salary dob e1 e2 e3 e4 e5 e6 name id Employee Entity set MIT 22033, Database Management Systems By: S.Sabraz Nawaz 12

E-R Model (Keys...) A candidate key is a combination of attributes that can be uniquely used to identify a database record If a table has one or more candidate keys, one of these candidate keys is selected as the table primary key and the rest are called alternate keys Primary key is underlined EMPLOYEES id MIT 22033, Database Management Systems By: S.Sabraz Nawaz 13

E-R Model (Keys...) A key formed by combining at least two or more columns is called composite key Always, the minimal set of attributes are considered for the key. Therefore, A key is a minimal set of attributes whose values uniquely identify an entity in the set. MIT 22033, Database Management Systems By: S.Sabraz Nawaz 14

E-R Model (Relationship) A relationship is an association among two or more entities o SaNa works for Department of MIT o Thilan works for Department of MIT A collection of similar relationships is called a relationship set MIT 22033, Database Management Systems By: S.Sabraz Nawaz 15

E-R Model (Relationship ) Graphically, EMPLOYEES works in DEPARTMENTS MIT 22033, Database Management Systems By: S.Sabraz Nawaz 16

E-R Model (Relationship ) A relationship can also have descriptive attributes These are used to record information about the relationship o E.g. SaNa works for MIS Department frm November 2006. In the figure, this is captured by the since in Works_In nic dob MIT 22033, Database Management Systems By: S.Sabraz Nawaz 17

E-R Model (Relationship ) 1/2/97 111 222 333 444 1/2/99 1/5/01 1/2/87 1/3/95 D1 D2 D3 Employees Departments Work_in MIT 22033, Database Management Systems By: S.Sabraz Nawaz 18

E-R Model (Relationship ) An instance of a relationship set is the set of relationships 1/1/91 111 222 333 444 3/3/93 2/2/92 3/1/92 3/1/92 D1 D2 D3 Employees MIT 22033, Database Management Systems By: S.Sabraz Nawaz Work_in Departments 19

E-R Model (contd.) Degree of a relationship is the number of participating entities in the relationship. A relationship of degree two is called a binary relationship (e.g. Works In) A relationship with degree three is called ternary. MIT 22033, Database Management Systems By: S.Sabraz Nawaz 20

E-R Model (contd.) Ternary relationship 111 222 333 444 D1 D2 D3 Departments Employees MIT 22033, Database Management Systems By: S.Sabraz Nawaz Work_in L1 L2 L3 Locations 21

E-R Model (contd.) Ternary relationship EMPLOYEES works in DEPARTMENTS LOCATIONS MIT 22033, Database Management Systems By: S.Sabraz Nawaz 22

E-R Model (contd.) The cardinality ratio for a binary relationship specifies the number of relationship instances that an entity can participate in. There are three types of cardinality ratios for binary relationships. o One-to-One o One-to-Many (Many-to-One) o Many-to-Many MIT 22033, Database Management Systems By: S.Sabraz Nawaz 23

E-R Model (contd.) One-to-One relationship Example: An employee manages at most one department. A department can have only one manager managing it. EMPLOYEES manages DEPARTMENTS MIT 22033, Database Management Systems By: S.Sabraz Nawaz 24

E-R Model (contd.) One-to-Many relationship For example, an employee works in at most one department. Graphically, EMPLOYEES works in DEPARTMENTS MIT 22033, Database Management Systems By: S.Sabraz Nawaz 25

E-R Model (contd.) Many-to-Many relationship Example: An employee can work on several projects. A project can have many employees working on it. EMPLOYEES works on PROJECTS MIT 22033, Database Management Systems By: S.Sabraz Nawaz 26

E-R Model (contd.) Participating constraint specifies whether the existence of an entity depends on its being related to another entity via the relationship type For example, if we specify that an employee must always work for a department. Then we say that the relationship works in is in total participation from Employee entity to Department entity EMPLOYEES works in DEPARTMENTS If the relationship is not in total participation, then it is known as in partial. o For example, from DEPARTMENTS to EMPLOYEES MIT 22033, Database Management Systems By: S.Sabraz Nawaz 27

E-R Model (contd.) Entity types without any key attributes is called weak entity types. A weak entity is uniquely identified by considering some of its attributes with the primary key of another entity called the identifying owner. The attributes in the weak entity participating in the key are called partial keys The owner entity and the weak entity participates in an identifying relationship. The cardinality of the identifying relationship is either one-to-one or one-to-many from owner entity to weak entity The weak entity must have total participation in the identifying relationship MIT 22033, Database Management Systems By: S.Sabraz Nawaz 28

E-R Model (contd.) Graphically (Weak Entity) EMPLOYEE 1 M Policy DEPENDENTS id name age MIT 22033, Database Management Systems By: S.Sabraz Nawaz 29

E-R Model (contd.) Entities participating in a relationship need not be distinct. Such relationships are called recursive relationships. Each entity in the relationship play a role in the relationship. It is recommended to state the role in recursive relationships. manages supervisor subordinate EMPLOYEES MIT 22033, Database Management Systems By: S.Sabraz Nawaz 30

Reference: Ramakrishnan, R., & Gehrke, J. (2003). Database management systems. Osborne/McGraw-Hill. (p. 24-50) MIT 22033, Database Management Systems By: S.Sabraz Nawaz 31