Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 1 Entity Relational Diagram (ERD) Modeling This particular lecture.

Slides:



Advertisements
Similar presentations
Entity Relationship Diagrams
Advertisements

Database Design The process of finding user requirement
Conceptual Data Modeling: ER
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Modeling Data The Entity Relationship Model (ER) For Database Design.
1 Database System Lifestyle System Definition Implementation Loading or data conversion Application conversion Testing and validation Operation Monitoring.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Week 3 Outline Overview of Database Design Process Example Database Application (COMPANY) ER Model.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – ER Model.
Entity Relationship Diagrams
CS 405G Introduction to Database Systems
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
Data Modeling Using the Entity-Relationship Model
Data Modeling Using the Entity-Relationship Model
Data Modeling Using the Entity-Relationship Model
1 Web-Enabled Decision Support Systems Entity-Relationship Modeling Prof. Name Position (123) University Name.
Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model.
the Entity-Relationship Model
CONCEPTS OF E-R MODEL. CONTENTS Entity Attributes Data Value Entity Types Types of Entity Types Relationships Relationship Constraints.
Lecture 2: Entity-Relationship Modeling
Chapter 5 1 © Prentice Hall, 2002 Chapter 5: Transforming EER Diagrams into Relations Mapping Regular Entities to Relations 1. Simple attributes: E-R attributes.
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Entities and Attributes
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Module Title? Data Base Design 30/6/2007 Entity Relationship Diagrams (ERDs)
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Data Modeling Using the Entity-Relationship
Entity-Relationship Model Ch. 3
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 7 Database Design and The E–R Model. 2 Goals n Facilitate DB design and represent the overall logical structure of the DB. n Definition Entities.
© Pearson Education Limited, Chapter 7 Entity-Relationship modeling Transparencies.
EXAMPLE. Subclasses and Superclasses Entity type may have sub-grouping that need to be represented explicitly. –Example: Employee may grouped into.
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
Entity – Relationship Model (E-R Model)
CS 405G: Introduction to Database Systems Lecture 2 : Database Design I.
Data modeling using the entity-relationship model Chapter 3 Objectives How entities, tuples, attributes and relationships among entities are represented.
Database Management Systems MIT Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Conceptual Modeling and Database Design.
Data Modeling Using the Entity-Relationship (ER) Data Model (Based on Chapter 3 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 3)
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
Data Modelling Using Entity-Relationship (ER) Model
Database Systems – ER Diagrams EXAMPLE COMPANY DATABASE Requirements of the Company (oversimplified to illustrate) The company is organized into DEPARTMENTs.
Sahar Mosleh California State University San MarcosPage 1 Database Design and Administration By: Sahar Mosleh.
Exam 1 Review Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
DatabaseIM ISU1 Fundamentals of Database Systems Chapter 3 Data Modeling Using Entity-Relationship Model.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 3: Data Modeling Using the Entity-Relationship (ER) Data Model
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Entity-Relationship Modeling. 2 Entity Type u Entity type –Group of objects with same properties, identified by enterprise as having an independent existence.
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
Lecture 5 Entity Relationship Modeling
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts - 6 th Edition Chapter 7: Entity-Relationship Model.
Database -Entity-Relationship Model 2012/03/05.
Chapter 7 Data Modeling Using the Entity-Relationship (ER) Model
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Lecture # 16 July 26,2012 Data Modeling using the Entity Relationship.
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
COP Introduction to Database Structures
Comp 1100 Entity-Relationship (ER) Model
Entity-Relationship Model
CS4222 Principles of Database System
Data Modeling Using the Entity- Relationship (ER) Model
Database Management Systems
ER model Ashima Wadhwa.
Entity Relationship Model
Chapter -3- Data Modeling Using the Entity-Relationship Model
بسم الله الرحمن الرحيم.
Entity Relationship Diagrams
Presentation transcript:

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 1 Entity Relational Diagram (ERD) Modeling This particular lecture is mainly prepared by the instructors at the University of Manitoba. Some contents are modified by Dr. Hadaegh and Mr. Jones for the students at the Red River College

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 2 ERD Model Entity-Relationship, ER Model ER model describes data as entities, relationships and attributes Entity A “thing” in the real world with an independent existence Physical existence Person, car, house or employee Conceptual existence Company, job, university course Attribute Property that describes entity employeeName, Address, Age, HomePhone companyName, Headquarters, President

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 3 Value A particular entity will have a value for each of its attributes The attribute values that describe each entity become a major part of the stored data Example employee: Name, Address, Age, HomePhone e1: “Bill Adams”, “561 Machray Hall”, “25”, “8831” e2: “John Smith”, “563 Queen Hall”, “30”, “8833”

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 4 Simple and Composite Attributes Simple attribute Attributes that are not divisible Ex: age, SSN, StudentId, etc Composite Attributes Can be divided into smaller subparts which represent more basic attributes with independent meaning. For example: Address consists of StreetAddress, City, State, PostalCode A date can consists of Day, Month, and Year

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 5 Stored and Derived Attributes Stored Attributes that are fixed and does not have to be calculated Ex: SSN, Marks, Name, etc… Derived Attributes that can be derived from other attributes either from the same entity or other entities. For example: Age can be derived from BirthDate or Grade, GPA can be derived from Marks Attribute values can be derived from other entities. NumberOfEmployees of a department in department entity can be derived by counting the number of employees who work in that department in the employee entity

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 6 Null Values Not Applicable A particular entity does not have an applicable value for an attribute ApartmentNumber is null because the family lives in the house and not in an apartment CollegeDegrees is null because the person never gone to the college Unknown Missing (value exists but not known) Height of a person Not Known (existence is not sure) HomePhone, OfficePhone

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 7 Entity An entity defines a collection object that have the same attributes Entity is described by its name and attributes Example: Employee[Number, Name, Title, Salary] Project[Number, Budget, Location] Entity instances are instantiations of the entity Example: EmployeeJoe, Jim,... ProjectCompiler design, Accounting,...

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 8 ER Notation Entity Rectangular box Enclosing the entity name Attribute Name Oval Attached to its entity by straight line Composite Attribute Attached to the component attribute by straight line EMPLOYEE EmpId

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 9 Attribute Notations Regular Attribute Key Attribute Derived Attribute... Composite Attribute

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 10 Key Attribute Values can be used to identify each entity uniquely. This plays the role of primary key in a table The key attribute is underlined in ER diagram Composite key Attributes Combination of the two or more attributes must be distinct for each instance. This plays the role of composite primary key in a table Entities may have more than one attribute that can be chosen as key attribute. For example, StudentId and SSN. However, you only have to pick one as the key (primary key) for the entity Entities can only have one primary key

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 11 E2 M. Smith E3 A. Lee E4 J. Miller E5 B. Casey E6 L. Chu E7 R. Davis E8 J. Jones E1 J. Doe EMPLOYEE Enum, Ename Entity name Attribute Instances

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 12 Entities PROJECTSUPPLIER PART EMPLOYEE LOCATION DEPARTMENT WAREHOUSE

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 13 Entities and Attributes PROJECTSUPPLIER PART LOCATIONDEPARTMENT WAREHOUSE Supplier No Supplier Name Location Project No Project Name Location Wareh. No Wareh. Name Location Part No Part Name QTYWGT City Dept. No Dept. Name Manager EMPLOYEE Emp. No Emp. Name TitleSalaryAddr

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 14 Entities, Attributes, and Relationship PROJECTSUPPLIER PART EMPLOYEE LOCATIONDEPARTMENT WAREHOUSE Supplier No Supplier Name Location Project No Project Name Budget Wareh. No Wareh. Name Location Part No Part Name QTYWGT City Dept. No Dept. Name Manager are supplied by supply are used by use works on has Emp. No Emp. Name TitleSalaryAddr Contains is contained in

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 15 Participation A participation constraint specifies whether the existence of an entity depends on its being related to another entity via the relationship type. For example, we can say that every employee that is hired by this company should work in at least in one department. Therefore, there is no reason to hire a employee and not being active in a particular department. This means the existence of the Employee entity depends on its being related to Department entity

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 16 Participation -- Cont There are two types of participation: total participation and partial participation Total Participation (existence dependency): Entity A has total participation in entity B if every instance of entity A relates to at least one instance of Entity B Ex: every department in this university should have a department chair Partial Participation: Entity A has partial participation in entity B if some of the instances of A (but not all instances) relate to some instances of entity B Ex: some faculties (but not all of them) are the chairs of the departments in this university

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 17 Weak Entities Entities that we have talked about so far, are all strong (regular) entity types. A strong entity type has key attributes of its own whereas a weak entity type does not have a a particular key attribute that can uniquely identify its instances. Entities belonging to a weak entity type are identified by being related to specific entities from another entity type in combination with one of their attribute values We can call the other entity type the Identifying or Owner Entity type and we call the relationship type that relates a weak entity to its owner entity Identifying Relationship

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 18 Weak Entities -- Cont For example, we can store the information about the dependants of an employee in a separate entity called Dependents. The Dependants entity can keep track of the name and other personal information of dependants of the employees. Note that it might be possible to have two different employees that have a daughter named “Nancy”. So name cannot be used as the primary key of Dependants entity In order to distinguish one instance of entity Dependants from another instance, we need to know the employee Id of the employees which is the primary key of Employee entity. The combination of employee id (that is a property of Employee entity) and the name attribute (that is a property of Dependants entity) can be used to create a primary key for the Dependants entity.

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 19 All Notations Regular entity RegularKeyDerived... Composite Identifying (Weak) Relationship Or Regular Relationship Weak entity Regular Relationship Identifying (Weak) Relationship Entities Attributes Relationships

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 20 Example of ERD Employee No Employee Name SalaryTitle Address CityApt. # Street # PROJECT Budget Project Name Project No TotalEmp Location WORKS ON Duration Responsibility WORKS ON EMPLOYEE

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 21 Relationships A relationship logically associates two or more entities with each other Binary relationship associates two entities Ternary relationship associates three entities with each other N-ary relationship associates n entities with each other

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 22 Relationship attributes Attributes can be attached to specific relationships. Attributes that belong to two different entities should be placed as the attribute of the relationship These values provide data about the relationship between the participating entity instances. PROJECT Budget Project Name Project No EMPLOYEE Employee No Employee Name SalaryTitle Responsibility WORKS ON WORKS ON Duration

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 23 Kinds of Relationships (Cardinality) Fundamental ones are: One-to-one Many-to-one (one-to-many) Many-to-many Recursive relationships A relationship between an entity and itself NOTE: There can be multiple relationships between two entities WORKS-IN EMPLOYEE MANAGES DEPARTMENT

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 24 One-to-One Relationship Each instance of an entity class E1 can be associated with at most one instance of another entity class E2 and vice versa. Example : Each employee can work on at most one project and each project employs at most one employee. PROJECT Budget Project Name Project No EMPLOYEE Employee No Employee Name SalaryTitle Responsibility WORKS ON Duration 1 1

Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 25 WorksOn Relationship EMPLOYEE PROJECT e1 e2 e e4 p1 p2 p p4 One-to-One Relationship