DataBase Lab Lab # 7 ER Using ERWin

Similar documents
Entity-Relationship Model. From Chapter 5, Kroenke book

More on the Chen Notation

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

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

Relational DB Design by ER- and EER-to-Relational Mapping Design & Analysis of Database Systems

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

Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping

Chapter 17. Methodology Logical Database Design for the Relational Model

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

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

PES Institute of Technology Bangalore South Campus (1 K.M before Electronic City,Bangalore ) Department of MCA. Solution Set - Test-II

Task: Design an ER diagram for that problem. Specify key attributes of each entity type.

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

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

Relational Database Systems Part 01. Karine Reis Ferreira

COSC 304 Introduction to Database Systems. Entity-Relationship Modeling

Conceptual Modeling in ER and UML

Database Management System 6 ER Modeling...

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

Conceptual Data Models for Database Design

Chapter 6: Entity-Relationship Model

Disk Operating System

Data Definition Language (DDL)

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

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

Chapter 2: Entity-Relationship Model

Chapter 2 Conceptual Modeling. Objectives

Data Manipulation Language (DML)


A l Ain University Of Science and Technology

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

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

Outline. Note 1. CSIE30600 Database Systems ER/EER to Relational Mapping 2

A l Ain University Of Science and Technology

MTAT Introduction to Databases

Chapter 6: Entity-Relationship Model

Logical Database Design. ICT285 Databases: Topic 06

ER modeling. Lecture 4

Lecture3: Data Modeling Using the Entity-Relationship Model.

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

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

Chapter 6: Entity-Relationship Model

Major components of ER diagram Practices

ER Modeling Data Modeling and the Entity-Relationship (ER) Diagram Pg 1

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

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

LECTURE 3: ENTITY-RELATIONSHIP MODELING

Copyright 2016 Ramez Elmasr and Shamkant B. Navathei

Answer 2.3 The ER diagram is shown in Figure 2.1.

Relational Database Components

Chapter 6: Entity-Relationship Model

Chapter 7: Entity-Relationship Model

Data Modeling Using the Entity-Relationship (ER) Model

Chapter 7: Entity-Relationship Model

EECS 647: Introduction to Database Systems

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

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

CSE 530A. ER Model. Washington University Fall 2013

Chapter 7: Entity-Relationship Model

Lab # 6. Data Manipulation Language (DML)

IS 263 Database Concepts

Entity-Relationship Model

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

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

ER Modeling ER Diagram ID-Dependent and Weak Entities Pg 1

Lab # 4. Data Definition Language (DDL)

RELATIONAL DATA MODEL

Entity-Relationship Models 2. Connolly/Begg Chapter 11

CSC 261/461 Database Systems Lecture 8. Spring 2018

MIS Database Systems Entity-Relationship Model.

Entity Relationship Diagram (ERD): Basics

1. Considering functional dependency, one in which removal from some attributes must affect dependency is called

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

Ch 9: Mapping EER to Relational. Follow a seven-step algorithm to convert the basic ER model constructs into relations steps 1-7

Chapter 2: ER-Diagrams. Content: Learn how to draw ER diagrams Useful to model a database

Information Systems Development 37C Lecture: Final notes. 30 th March 2017 Dr. Riitta Hekkala

Module 2 : Entity-Relationship Model 15

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

Chapter # 4 Entity Relationship (ER) Modeling

Week 4 Tute/Lab Entity-Relationship (ER) Model

Intro to DB CHAPTER 6

Database Management System (15ECSC208) UNIT I: Chapter 1: Introduction to DBMS and ER-Model

Chapter 2 ENTITY RELATIONSHIP MODEL

CS 405G: Introduction to Database Systems

Database Design Process

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

Agenda: Understanding Relationship Types Degree and Cardinality with Examples

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

COSC344 Database Theory and Applications. σ a= c (P) S. Lecture 4 Relational algebra. π A, P X Q. COSC344 Lecture 4 1

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

CA ERwin Data Modeler

LECTURE 6: GUIDELINES FOR GOOD RELATIONAL DESIGN MAPPING ERD TO RELATIONS

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

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

GUJARAT TECHNOLOGICAL UNIVERSITY

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

Review The Big Picture

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

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

Transcription:

In the name of Allah Islamic University of Gaza Faculty of Engineering Computer Engineering Department ECOM 4113 DataBase Lab Lab # 7 ER Using ERWin El-masry 2013

Objective To be familiar with Entity Relationship Model Design using ERWin program. Introduction To ERWin ERWin is a powerful tool which allows database designers to enter their Entity Relationship (ER) diagrams in a graphical form and produce physical database designs. Model Types in ERWin: 1. Logical: A conceptual model that includes entities, relationships, and attributes. This model type is essentially at the ER modeling level. 2. Physical: A database specific model that contains relational tables, columns and associated data types. 3. Logical/Physical: A single model that includes both the conceptual level objects as well as physical level tables. In this lab we will use Logical/Physical model type. Creating ER Diagrm Using ERWin 1- Launch ERWin program. 2- File menu >> New. 2

3- Choose the type of model. Typically the Logical/Physical model type should be chosen if the final goal is to produce a relational design for the database. The target database may also be chosen. 4- Rename the model to DataBase Name. Right Click on Model Name >> properties >> Enter the new Name, e.g. COMPANY >> OK. 3

Note: 5- Adding Entity Types of the DataBase We add all Entity Types of the DataBase (strong and weak), such that ERWin will classify an entity type as weak as soon as it participates in an identifying relationship. EMPLOYEE Right Click on Entities >> New. Or Click on then click on Display Window. Name The Entity Type. DEPARTMENT 4

After adding all Entity Types of COMPANY. Note: 6- Adding Attributes of the Entity Types Multi-valued attributes cannot be modeled easily with ERWin. To handle such attributes, a separate entity type is created and a many-to-many relationship between the original entity type and new entity type will be established. EMPLOYEE RIGHT Click on Entity >> Attributs 5

Click New. Enter Attribute Name and choose its Domain (Data Type) >> OK. Datatype Tab >> choose precise Data Type. 6

If the attribute is a primary key (PK) or a part of PK, select Primary Key option in General Tab of the attribute. To add a new attribute click New and repeat previous steps. After adding All EMPLOYEE Attributes After Finish, Click OK. 7

In the same way, add Attributes of the remaining Entity Types. Note: We added a new Entity Type DLOCATION to location multi-valued attribute of DEPARTMENT Entity Type. 7- Adding Relationships between Entity Types Right Click Relationships >> New. Choose Relationship Type, Parent and Child >> OK. Relationships Types In ERWin : Identifying. Non-Identifying. Many-To-Many. Parent: is the Entity Type which we add its PK to another Entity Type in the Relationship. Child: is the Entity Type which contains the foreign key (FK). 8

Note: ERWin classifies the child entity type in an identifying relationship as weak. The new relationship is added and is reflected by a line connecting the two entity types, double click on it to edit its cardinality and other properties. Cardinality: Add the cardinality of the relationship in (min,max) natation. If the relationship has attributes, add these attributes where ERWin add the FK. COMPANY Relationships Belongs_To EMPLOYEE (1,1) Belongs (1,N) _To DEPARTMEN T Non_Identifying Relationship. We will add to each EMPLOYEE, his DEPARTMENT, then the parent is DEPARTMENT and the child is EMPLOYEE. 9

Cardinality Parent To Child DEPARTMENT To EMPLOYEE (1,1) To (1,N) Then: We search for (one to one or more) cardinalty in ERWin. 10

Note: Non_identifying relationship represented by dashed line (------), ended by solid dot where FK is added. Manages Mgr_Start_Date EMPLOYEE (0,1) Manages (1,1) DEPARTMEN T Non_Identifying Relationship. We will add to each DEPARTMENT, his MANAGER, then the parent is EMPLOYEE and the child is DEPARTMENT. Cardinality Parent To Child EMPLOYEE To DEPARTMENT (1,1) To (0,1) Then: We search for (one to zero or one) cardinalty in ERWin. 11

Add Mgr_Start_Date Attribute To DEPARTMENT 12

Supervision EMPLOYEE Supervisor (0,N) Supervised (0,1) Supervision Non_Identifying Relationship. We will add to each EMPLOYEE, his Supervisor, then the parent is EMPLOYEE as Supervisor and the child is EMPLOYEE as Supervised. Cardinality Parent To Child Supervisor To Supervisd (0,1) To (0,N) Then: We search for (zero or one to zero or more) cardinalty in ERWin. 13

Because it is a reflexive relationship, We have to rename FK. Controls DEPARTMENT (0,N) Controls (1,1) s PROJECT Non_Identifying Relationship. We will add to each PROJECT, its DEPARTMENT, then the parent is DEPARTMENT and the child is PROJECT. 14

Cardinality Parent To Child DEPARTMENT To PROJECT (1,1) To (0,N) Then: We search for (one to zero or more) cardinalty in ERWin. 15

Dependent_of DEPENDENT (1,1) Depend (0,N) ent_of EMPLOYEE Identifying Relationship. Owner Entity Type is a Parent, and the weak Entity Type is the child, then the parent is EMPLOYEE and the child is DEPENDENT. Cardinality Parent To Child EMPLOYEE To DEPENDENT (1,1) To (0,N) Then: We search for (one to zero or more) cardinalty in ERWin. 16

Notes: Identifying relationship represented by solid line () ended by solid dot towards Weak Entity Type. Weak entity types are denoted by rounded rectangles. 17

Works_ON Hours EMPLOYEE (1,N) Works_ ON (1,N) Project Many To Many Relationship. Its Parent and Child can be exchanged. Cardinality It is M-N, so we don t need to determine its cardinality again. Notes: Many to Many relationship represented by solid line,() ended by two solid dots. We will postpone addition of Hours Attribute, until we Transform Logical ER to physical ER. 18

Dept_Location DEPARTMENT (1,N) Dept_L ocation (1,N) DLOCATION Many To Many Relationship. 19

Final Logical ER Model Physical ER Model To convert Logical ER Model to Physical ER Model, we need to transform many to many relationships to their physical model. Many to Many Realtionship Transformation Select M-N relationship >> Edit menu >> Many To Many Transform. If the relationship has attributes, add them to the new Entity Type. 20

Works_ON Transform 21

Add Hours Attribute. 22

Dept_Location Transformation 23

Final Physical ER Diagram 24

EXERCISE Your task is to design a database for a clinic system, which maintains information about patients and their visits to the clinic to be treated by the physicians. Draw an ER diagram to model the application with the following assumptions. Specify key attributes of each entity type and (min, max) constraints on each relationship type. Note any unspecified requirements, and make appropriate assumptions to make the specification complete. Then Build the design using ERWin. Each patient uniquely defined by patient number, first name, last name, street, city and the patient health plan. The patient can attend many visits. Each physician has a unique physician number, first name, last name, specialty, phone, hospital. A physician is required for a visit. New physicians don't have associated visits. Each visit has visit number, visit date, VisitPayMethod (cash,check,or credit card), visit charge. A physician can treat many visits. The clinic issues a visit details to record the details about a visit. At the time goes on, there will be multiple details of the same visit. A visit detail includes a detail number, a detail charge,an optional nurse number and an associated item. All the details of the same visit have different detail number, but two different visits could have details with the same detail number. Each item includes a unique item number, an item description, an item price, and an item type. An item can be related to multiple visit details. New items may not be related to any visit details. Each nurse has a unique nurse number, first name, last name, title, specialty, phone and NursePayGrade. A nurse can provide multiple visit details or may not provide any visit details. 25