Data Modeling Using the Entity-Relationship Model

Slides:



Advertisements
Similar presentations
the Entity-Relationship (ER) Model
Advertisements

Lecture plan Outline of DB design process Entity-relationship model
Chapter 31 Chapter 3 Data Modeling Using the Entity-Relationship Model.
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
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.
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
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
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
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Entities and Attributes
Entity-Relationship (ER) Data Model 概念資料模式 (Based on Chapter 3 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 4)
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
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
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.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 7: Modeling Data in the Organization Dr. Taysir Hassan Abdel Hamid IS Department Faculty of Computer and Information Assiut University March 8,
Entity-Relationship Model Using High-Level Conceptual Data Models for Database Design Entity Types, Sets, Attributes and Keys Relationship Types, Sets,
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:
CS 405G: Introduction to Database Systems Lecture 2 : Database Design I.
Database Management COP4540, SCS, FIU Database Modeling Using the Entity-Relationship Model (Continued)
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Conceptual Modeling and Database Design.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Entity-Relationship Model Chapter 3 II COSC 457 Sungchul Hong.
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 Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
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.
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.
Exam 1 Review Dr. Bernard Chen Ph.D. University of Central Arkansas.
Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 3: Data Modeling Using the Entity-Relationship (ER) Data Model
An Introduction to Database Systems دانشگاه علم و فناوری مازندران - طراحی و ایجاد بانک های اطلاعاتی 1.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Conceptual Modelling The Entity-Relationship (ER) Model The ER diagram Data Modelling.
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.
Data Modeling Using the Entity- Relationship (ER) Model
Comp 1100 Entity-Relationship (ER) Model
Data Modeling Using the Entity- Relationship (ER) Model
Databases (CS507) CHAPTER 7.
Chapter 3 Data Modeling Using the Entity-Relationship Model
CS4222 Principles of Database System
Data Modeling Using the Entity- Relationship (ER) Model
Database Management Systems
Entity- Relationship (ER) Model
ER model Ashima Wadhwa.
Entity-Relationship Model
Entity Relationship Model
Lecture3: Data Modeling Using the Entity-Relationship Model.
بسم الله الرحمن الرحيم.
Entity Relationship Diagrams
Initial Design of Entity Types: EMPLOYEE, DEPARTMENT, PROJECT, DEPENDENT Gender.
Conceptual Data Modeling Using Entities & Relationships
Entity Relation Model Tingting Zhang.
Presentation transcript:

Data Modeling Using the Entity-Relationship Model

Contents Introduction Database Design Process An example of Database Application Entity Types, Entity Sets, Attributes and Keys Relationships, Relationship Types, Roles and Structural Constraints Weak Entity Types ER Diagrams, Naming Conventions and Design Issues Ref: Chapter 3, Navathe

1. Introduction Conceptual modeling is an important phase in designing a successful database application. Database application: which refers to particular database, e.g. BANK.

2. Database Design Process

Requirement collection and analysis: interviewing prospective database users to understand and document their data requirements. Specifying known functional requirements (user defined operation that will be applied to the database and they include both retrievals and update) of the application. Conceptual design: Creating conceptual schema for the database using high level conceptual data model. Conceptual schema is a concise description of data requirements of the user and includes detailed descriptions of the entity type, relationships and constraints. Reference to ensures all users’ data requirements are meet and that the requirements do not include conflicts. This enables database designers to concentrate on specifying the properties of the data rather than storage details.

Logical Design or Data modeling: Actual implementation of database design using commercial DBMS. Uses relational or object database model. Result is a database schema in the implementation data model of the DBMS. Physical Design: Specify internal storage structures, access paths and file organization for the database files. Application programs are designed and implemented as database transaction corresponding to the high-level transaction specifications.

3. An example of Database Application Database Application: Company Requirements: Keeps track of a company’s employees, department, and projects Departments Unique name & number A particular employee manages a department Start date when the manager began managing Department may have several locations Projects Single location Controlled by a department

Employees Dependents Name SSN (IRD) Address Salary, sex & birth date Assigned to one department, but may work on several projects Track number of hours per week that an employee works on each project Track the direct supervisor of each employee Dependents First name Sex & birth date Relationship to employee

4. Entity Types, Entity Sets, Attributes and Keys Entities and Attributes Entity Types, Entity Sets, Keys and Value Sets Initial conceptual design of the Company database Entity: which is a “thing” in the real world with an independent existence It may be an object with a physical existence, e.g. person, car, house or employee. It may be an object with a conceptual existence, e.g. a company, a job, or an university course. Attribute: The particular properties that describe entity, e.g. employee entity may be described by name, age, address, salary and job. Attribute value

Types of Attributes: Entity Types: Composite / Simple (Atomic): Address Single-valued/ Multivalued: age / college degrees Stored/ Derieved: Birth date / age Null: e.g. apartment number, Null can also be used if we do not know the value of an attribute for a particular entity (e.g. Home phone) Complex Attributes: Nesting composite and multivalued attribute in an arbitrary way. E.g. Attribute AddressPhone for PERSON entity {AddressPhone({Phone(AreaCode, PhoneNumber)}, Address(StreetAddress(Number, Street, ApartmentNumber), City, State, Zip))} Entity Types: Collection or set of entities that have the same attributes. Represented in ER diagram as a rectangular box enclosing the entity type name. Attributes are enclosed in ovals, multivalued attribute are displayed in double ovals. It describes the schema or intension for a set of entities that share the same structure.

Key Attributes of an Entity Type: Entity Set: The collection of all entities of a particular type in the database at any point in the time. E.g. The set of all persons having an account at a bank is the entity set CUSTOMER. Set of all accounts in a particular bank is the entity set ACCOUNT. Key Attributes of an Entity Type: Uniqueness constraint on attributes Attribute whose values are distinct for each individual entity in the collection. Composite attribute as a key attribute. In ER diagram key attribute are underlined. Weak entity type: entity type with no key. Value Sets (Domain) of attribute: Set of values that may be assigned to attribute. E.g. Age (20-70), name(alphabetic and space)

Initial conceptual design of the Company database

Problem Composite and multivalued attributes can be nested to any number of levels. Suppose we want to design an attribute for a STUDENT entity type to keep track of previous college education. Such an attribute will have one entry for each college previously attended and each such entry will be composed of college name, start and end dates, degree entries, and transcript entries. Each degree entry contains the degree name and the month and year the degree awarded, and each transcript entry contains a course name, semester, year, and grade. Design attribute to hold this information.

Relationships, Relationship Types, Roles and Structural Constraints Introduction Relationship Types, Sets and Instances Relationship Degree, Role Names and Recursive Relationships Constraints on Relationship Types Attributes of Relationship Types

Introduction Attribute of one entity type refers to another entity type. The attribute Manager of DEPARTMENT refers to an employee who manages the department Department. The attribute ControllingDepartment of PROJECT refers to the department that controls the project. The attribute Supervisour of EMPLOYEE refers to another employee. The attribute Department of EMPLOYEE refers to the department for which the employee works. In the ER model, references (between entity types) should be represented as relationships, not attributes. A relationship is an association among several entities. Relationship will be shown as diamond-shaped boxes in the ER diagram

Relationship Types, Sets and Instances A relationship type R among n entity types E1, E2, . . ., En defines a set of associations or a relationship set among entities from these types. As for entity types and entity sets, relationship type and its corresponding relationship set are customarily referred to by the same name R. Each of the entity types E1, E2, . . .,En is said to participate in the relationship type R. Relationship set is a set of relationships of the same type.

CUSTOMER : ACCOUNT ; CustAcct ri – relationship instances CUSTOMER : ACCOUNT ; CustAcct

Relationship Degree, Role Names and Recursive Relationships Degree of Relationship Type: number of participating entity type WORKS_FOR relationship is of degree 2. Relationship type of degree 2 is called binary and degree 3 is called ternary.

Relationships as Attributes: WORKS_FOR relationship type represents attributes Department of EMLOYEE or Employees of DEPARTMENT. Role Names and Recursive Relationships: Each entity type that participates in a relationship type plays a particular role in the relationship. Role Name Signifies the role of the participating entity Helps to explain what the relationship means Not necessary where participating entity types are distinct (WORKS_FOR) Recursive Relationships: Participation of the same entity types more than once in a relationship type.

1 – Supervisor 2 - Supervisee

Constraints on Relationship Types: Cardinality Ratio: Cardinality specifies the number of relationship instances that an entity can participate in 1:N (DEPARTMENT : EMPLOYEE ; WORKS_FOR) 1:1 (EMPLOYEE : DEPARTMENT; MANAGES) M:N (EMPLOYEE : PROJECT ; WORKS_ON)

Participation Constraints and Existence Dependencies: Specifies whether the existence of an entity depends on its being related to another entity via the relationship type Types Total (Existence dependency) If every employee must work for a department, then an employee entity can exist only if it participates in a WORKS_FOR relationship. Every entity in “the total set” of employee entities must be related to a department entity by the WORKS_FOR relationship. Total participation is also called existence dependency.

Total participation is shown as a double line Partial Every employee is not expected to manage a department. A “part of the set” of employees are related to a department by the MANAGES relationship. Total participation is shown as a double line Partial participation is shown as a single line Attributes of Relationship Types Relationship types can have attributes Consider the number of hours per week that an employee works on a particular project Hours attribute on WORKS_ON relationship

Weak Entity Types: Entity types that do not have key attributes of their own Entities belonging to a weak entity type are identified by being related to specific entities from another entity type (identifying or owner entity type) in combination with some of the attribute values. Has a total participation constraint with respect to its owning entity type Consider the DEPENDENT entity type (two distinct employees may have the same value for attribute for DEPENDENT) Partial key A set of attributes that can uniquely identify the weak entities that are related to the same owner entity (no two dependents of the same employee ever have the same first name, “Name”-Partial key) Boxes and diamonds are double lines

Refining the ER Design for the COMPANY Database MANAGES 1:1 between EMPLOYEE & DEPARTMENT EMPLOYEE participation is partial DEPARTMENT participation is unclear StartDate attribute WORKS_FOR 1:N between DEPARTMENT & EMPLOYEE Both participations are total CONTROLS 1:N between DEPARTMENT & PROJECT PROJECT participation is total DEPARTMENT participation is partial

SUPERVISION 1:N between EMPLOYEE (in supervisor role) & EMPLOYEE (in supervisee role) Both participations determined to be partial after users indicate not every employee has a supervisor. WORKS_ON M:N between EMPLOYEE & PROJECT Both participations are total Hours attribute DEPENDENTS_OF 1:N between EMPLOYEE & DEPENDENT EMPLOYEE participation is partial DEPENDENT participation is total

ER Diagram Notation