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

Slides:



Advertisements
Similar presentations
Conceptual Data Modeling: ER
Advertisements

Chapter 31 Chapter 3 Data Modeling Using the Entity-Relationship Model.
1 Entity-Relationship Model Gang Qian Department of Computer Science University of Central Oklahoma.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 3- 1.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Week 3 Outline Overview of Database Design Process Example Database Application (COMPANY) ER Model.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
4/17/2017.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
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
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Data Modeling Using the Entity-Relationship (ER) Model CS 340: Introduction to Databases.
Topic 3 Data Modeling Using the Entity-Relationship (ER) Model
METU Department of Computer Eng Ceng 302 Introduction to DBMS Entity-Relationship (ER) Model by Pinar Senkul resources: mostly froom Elmasri, Navathe and.
the Entity-Relationship Model
Entities and Attributes
Outline What is ER Model? And Why? Example COMPANY Database
Entity-Relationship Model. 2 Outline  What is ER Model? And Why?  Overview of Database Design Process  Example COMPANY Database  ER Model Concepts.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
Entity-Relationship (ER) Data Model 概念資料模式 (Based on Chapter 3 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 4)
Data Modeling Using the Entity-Relationship (ER) Model
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
Lecture On Database Analysis and Design By- Jesmin Akhter Lecturer, IIT, Jahangirnagar University.
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 3 Data Modeling Using the Entity- Relationship (ER) Model.
Data Modeling Using the Entity- Relationship (ER) Model.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
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.
Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model Copyright © 2004 Pearson Education, Inc.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
Slide Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
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 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
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 3- 1.
Lecture # 6.  A class of data models  Conveys semantic meaning  Implements databases more intelligently  Support more sophisticated user interfaces.
Database Systems – ER Diagrams EXAMPLE COMPANY DATABASE Requirements of the Company (oversimplified to illustrate) The company is organized into DEPARTMENTs.
Chapter 2 Data Modeling Using the Entity-Relationship (ER) Model Copyright © 2004 Pearson Education, Inc.
ER Modeling The main reference of this presentation is the textbook and PPT from : Elmasri & Navathe, Fundamental of Database Systems, 4 th edition, 2004,
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) Model Copyright © 2004 Pearson Education, Inc.
Chapter 3: Data Modeling Using the Entity-Relationship (ER) Data Model
Copyright © 2016 Ramez Elmasr and Shamkant B. Navathei CHAPTER 3 Data Modeling Using the Entity-Relationship (ER) Model Slide 1- 1.
Data Modeling Using the Entity-Relationship (ER) Model
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
Example COMPANY Database
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Lecture # 16 July 26,2012 Data Modeling using the Entity Relationship.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Lecture # 17 July 28,2012 Data Modeling using the Entity Relationship.
Data Modeling Using the Entity-Relationship (ER) Model
Data Modeling Using the Entity- Relationship (ER) Model
CS4222 Principles of Database System
Data Modeling Using the Entity- Relationship (ER) Model
Database Management Systems
ER model Ashima Wadhwa.
Entity Relationship Model
College of Arts & Science Computer Science Department
Data Modeling Using the Entity- Relationship Model
Initial Design of Entity Types: EMPLOYEE, DEPARTMENT, PROJECT, DEPENDENT Gender.
Presentation transcript:

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

ER Model Concepts  ER Model (Entity-relationship model): describes data as entities, attributes and relationships.  Entities: Entities are specific objects or things in the mini-world that are represented in the database. The basic object that the ER model represents is an entity,  Example: the EMPLOYEE John Smith.  Attributes: are properties used to describe an entity. Each entity has attributes.  Example: an EMPLOYEE entity may have a Name, Address, Sex, Birthdate.

ER Model Concepts  A specific entity will have a value for each of its attributes.  Example: a specific employee entity may have Name='John Smith', Address ='731, Fondren, Houston, TX', Sex='M', BirthDate='09-JAN-55‘  Each attribute has a value set (or data type) associated with it – e.g. integer, string, enumerated type, …

Types of Attributes  Simple (or atomic): Attributes that are not divisible. For example, Sexual, SSN(Social Security number), …  Composite: Attributes can be divided into smaller subparts, which represent more basic attributes with independent meanings.  Example:  Address (Apt#, House#, Street, City, State, ZipCode, Country)  Name (FirstName, MiddleName, LastName).  Composition may form a hierarchy where some components are themselves composite.

Types of Attributes

 Multi-valued: In some cases an attribute can have a set of values for the same entity  Example:  Color of a CAR  Previous Degrees of a STUDENT.  A multivalued attribute may have lower and upper bounds to constrain the number of values allowed for each individual entity.

Types of Attributes  Complex Attributes:  Composite and multivalued attributes can be nested in an arbitrary way.  Arbitrary nesting is represented by grouping components of a composite attribute between parentheses () and separating the components with commas, and by displaying multivalued attributes between braces {}.  Example: {AddressPhone({Phone(AreaCode, PhoneNumber)}, Address(StreetAddress(Number, Street, ApartmentNumber), City,State,Zip) ) }

Entity Types and Key Attributes  Entity type: Entities with the same basic attributes are grouped or typed into an entity type. For example, the EMPLOYEE entity type.  Key Attributes: An entity type usually has an attribute whose values are distinct for each individual entity in the entity set. Such an attribute is called a key attribute, and its values can be used to identify each entity uniquely.

Entity Types and Key Attributes  A key attribute may be composite. For example, VehicleTagNumber is a key of the CAR entity type with components (Number, State).  An entity type may have more than one key. For example, the CAR entity type may have two keys:  VehicleIdentificationNumber (popularly called VIN)  VehicleTagNumber (Number, State), also known as license_plate number.

Entity Types and Key Attributes

NOTATION FOR ER SCHEMAS Entity Type Weak entity type Relationship type Identifying relationship type Attribute Key attribute Multivalued attribute Composite attribute Derived attribute Total participation of E 2 in R Cardinality ratio 1:n for E 1 :E 2 in r Structural constraint (min, max) on participation of E in R E1E1 R E2E2 E1E1 R E2E2 R (min,max) E N

Relationships and Relationship Types  A relationship: relates two or more distinct entities with a specific meaning.  Example: EMPLOYEE John Smith works on the ProductX PROJECT.  A relationship type R among n entity types E1, E2, …, En defines a set of associations among entities from these entity types.  Example, the WORKS_ON relationship type in which EMPLOYEEs and PROJECTs participate.

Relationships and Relationship Types

 More than one relationship type can exist with the same participating entity types.  Example: MANAGES and WORKS_FOR are distinct relationships between EMPLOYEE and DEPARTMENT, but with different meanings and different relationship instances.

Relationships and Relationship Types

Relationship Degree  The degree of a relationship type is the number of participating entity types.  Binary: A relationship type of degree two Example: Both MANAGES and WORKS_ON are binary relationships  Ternary: Relationship types of degree three  n-ary: Relationship types of degree n.

Relationship Degree

Role Names, and Recursive Relationships  Role Names: Each entity type that participates in a relationship type plays a role in the relationship. The role name signifies the role that a participating entity from the entity type plays in each relationship instance.  Recursive relationships: The same entity type participates more than once in a relationship type in different roles.

Role Names, and Recursive Relationships  For example, SUPERVISION relationships between EMPLOYEE (in role of supervisor or boss) and (another) EMPLOYEE (in role of subordinate or worker).

Role Names, and Recursive Relationships  Recursive Relationship Type is: SUPERVISION (participation role names are shown)

Example COMPANY Database  Requirements of the Company:  The company is organized into DEPARTMENTs. Each department has a name, number and an employee who manages the department.  Each department controls a number of PROJECTs. Each project has a name, number and is located at a single location.  We store each EMPLOYEE’s social security number, address, salary, sex, and birthdate.

Example COMPANY Database  Each employee works for one department but may work on several projects.  We keep track of the number of hours per week that an employee currently works on each project.  We also keep track of the direct supervisor of each employee.  Each employee may have a number of DEPENDENTs. For each dependent, we keep track of their name, sex, birthdate, and relationship to employee.

Initial Conceptual Design of the COMPANY Database

Weak Entity Types  An entity that does not have a key attribute  A weak entity must participate in an identifying relationship type with an owner or identifying entity type  Entities are identified by the combination of:  A partial key of the weak entity type  The particular entity they are related to in the identifying entity type

Weak Entity Types Example: Suppose that a DEPENDENT entity is identified by the dependent’s first name and birthdate, and the specific EMPLOYEE that the dependent is related to. DEPENDENT is a weak entity type with EMPLOYEE as its identifying entity type via the identifying relationship type DEPENDENT_OF

Constraints on Relationship Types  Maximum Cardinality (The cardinality ratio) for a binary relationship specifies the maximum number of relationship instances that an entity can participate in.  One-to-one (1:1)  One-to-many (1:N) or Many-to-one (N:1)  Many-to-many  Minimum Cardinality (participation constraint or existence dependency constraints)  Zero (optional participation, not existence- dependent)  One or more (mandatory, existence-dependent)

Constraints on Relationship Types

 Cardinality ratios for binary relationships are represented on ER diagrams by displaying 1, M, and N.

Attributes of Relationship types  A relationship type can have attributes; for example, HoursPerWeek of WORKS_ON; its value for each relationship instance describes the number of hours per week that an EMPLOYEE works on a PROJECT.

Attributes of Relationship types

Alternative (min, max) notation for relationship structural constraints  Specified on each participation of an entity type E in a relationship type R  Specifies that each entity e in E participates in at least min and at most max relationship instances in R  Default(no constraint): min=0, max=n  Must have min  max, min  0, max  1  Derived from the knowledge of mini-world constraints

Alternative (min, max) notation for relationship structural constraints  Example:  A department has exactly one manager and an employee can manage at most one department.  Specify (0,1) for participation of EMPLOYEE in MANAGES  Specify (1,1) for participation of DEPARTMENT in MANAGES  An employee can work for exactly one department but a department can have any number of employees.

Alternative (min, max) notation for relationship structural constraints  Specify (1,1) for participation of EMPLOYEE in WORKS_FOR  Specify (0,n) for participation of DEPARTMENT in WORKS_FOR

COMPANY ER Schema Diagram using (min, max) notation