ER model Ashima Wadhwa.

Slides:



Advertisements
Similar presentations
Conceptual Data Modeling: ER
Advertisements

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.
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.
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.
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.
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: 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 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.
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:
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.
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.
Chapter 2 Data Modeling Using the Entity-Relationship (ER) Model Copyright © 2004 Pearson Education, Inc.
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
Ashima Wadhwa. database  A database can be modeled as: ◦ a collection of entities, ◦ relationship among entities. entity  An entity is an object that.
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Lecture # 16 July 26,2012 Data Modeling using the Entity Relationship.
Data Modeling Using the Entity-Relationship (ER) Model
Entity Relationship (E-R) Model
Data Modeling Using the Entity- Relationship (ER) Model
Comp 1100 Entity-Relationship (ER) Model
Data Modeling Using the Entity- Relationship (ER) Model
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 Model
Entity Relationship Model
Chapter -3- Data Modeling Using the Entity-Relationship Model
Lecture3: Data Modeling Using the Entity-Relationship Model.
Data Modeling Using the Entity-Relationship (ER) Model
بسم الله الرحمن الرحيم.
Entity Relationship Diagrams
Data Modeling Using the Entity- Relationship Model
Initial Design of Entity Types: EMPLOYEE, DEPARTMENT, PROJECT, DEPENDENT Gender.
Conceptual Data Modeling Using Entities & Relationships
Data Modeling Using the Entity-Relationship (ER) Model
Entity Relation Model Tingting Zhang.
Data Modeling Using the Entity-Relationship (ER) Model
Data Modeling Using the Entity-Relationship (ER) Model
Data Modeling Using the Entity-Relationship (ER) Model
Presentation transcript:

ER model Ashima Wadhwa

ER Model ER model describes data as entities, relationships, and attributes

Entities and Attributes The most basic object that the ER model represents is an entity An entity maybe an object with a physical existence (a person, a car, house…) or it maybe an object with conceptual existance (a company, a job, or a course) Each entity has Attributes --- the particular properties that describe it

Attributes Several types of attribute occur in the ER model Simple vs. Composite Single value vs. Multi-value Stored vs. Derived NULL Values Complex Attribute

Composite vs. Simple Attributes Composite attributes can be divided into smaller subparts. For example: Address attribute of the EMPLOYEE entity can be further subdivided into street_address, city, state, zip_code Simple attributes can not be further divisible For example, street_address can be subdivided into Number, street, and apt# The value of composite attribute is the concatenation of the values of its constituent simple attributes

Example of a composite attribute

Single value vs. Multi-value Most attributes have a single value for a particular entity; such attribute are called single-valued In some cases an attribute can have a set of value for the same entity --- for example, colors attribute for a car, or a college_degree for a person Such attributes are called multivalued A multivalued attribute may have lower and upper bonds to constrain the number of values allowed for each entity

Stored vs. Derived In some cases, two (or more) attribute calues are related --- for example, the Age and Birth_date of a person The Age attribute is called a derived attribute and is said to be derived from the Birth_date attribute, which is called a stored value

NULL Values In some cases, a particular entity may not have an applicable value for an attribute For example, apt#, college degree, NULL can also be used if we do not know the value of an attribute for a particular entity---home phone The meaning of the former type of NULL is not applicable, whereas the meaning of the later is unknown

Complex Attribute We may have composite attribute arbitrarily combined with multi-valued attribute, it is called Complex Attribute For example: if a person can have more than one residence and each residence can have a single address and multiple phones

Entity Types A database usually contains groups of entities that are similar An entity type defines a collection of entities that have the same attributes For example---EMPLOYEE An entity type is represented in ER diagrams as a rectangular box enclosing the entity type name Attributes names are enclosed in ovals and are attached to their entity type by straight lines Composite attributes are attached to their component attributes by straight lines Multivalued attributes are displayed in double ovals

Entity Type CAR with two keys and a corresponding Entity Set

Key Attributes An important constrain on the entities of an entity type is the KEY on attributes An attribute of an entity type for which each entity must have a unique value is called a key attribute of the entity type. For example, SSN of EMPLOYEE.

Entity Types and Key Attributes (2) A key attribute may be composite. VehicleTagNumber is a key of the CAR entity type with components (Number, State). An entity type may have more than one key. The CAR entity type may have two keys: VehicleIdentificationNumber (popularly called VIN) VehicleTagNumber (Number, State), aka license plate number. Each key is underlined

Entity Type CAR with two keys and a corresponding Entity Set

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: DEPARTMENT PROJECT EMPLOYEE DEPENDENT Their initial design is shown on the following slide The initial attributes shown are derived from the requirements description

Department The company is organized into DEPARTMENTs. Each department has a name, number and an employee who manages the department. We keep track of the start date of the department manager. A department may have several locations.

Projects Each department controls a number of PROJECTs. Each project has a unique name, unique number and is located at a single location.

EMPLOYEE We store each EMPLOYEE’s name, social security number, address, salary, sex, and birthdate. 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.

Dependent Each employee may have a number of DEPENDENTs. For each dependent, we keep track of their name, sex, birthdate, and relationship to the employee.

Initial Design of Entity Types: EMPLOYEE, DEPARTMENT, PROJECT, DEPENDENT

Relationship The initial design is typically not complete Refining the initial design by introducing relationships ER model has three main concepts: Entities (and their entity types and entity sets) Attributes (simple, composite, multivalued) Relationships (and their relationship types and relationship sets)

Relationship type vs. relationship set Is the schema description of a relationship Identifies the relationship name and the participating entity types Also identifies certain relationship constraints Relationship Set: The current set of relationship instances represented in the database The current state of a relationship type

Relationship In ER diagrams, we represent the relationship type as follows: Diamond-shaped box is used to display a relationship type Connected to the participating entity types via straight lines

Relationship example Consider a relationship type work_for between the two entities type EMPLOYEE and DEPARTMENT Each relationship instance in the relationship set associates one EMPLOYEE entity and one DEPARTMENT entity

Relationship between EMPLOYEE and DEPARTMENT

Degree of Relationship Type The degree of a relationship is the number of participating entity types A relationship type of degree two is called Binary, and one of degree three is called Ternary Work_for relationship is binary An example of ternary relationship is SUPPLY---where S supply part P to project J

Recursive Relationship In some cases, the same entity type participates more than once in a relationship type in different roles Example Employee and supervised

Constrains on Relationship types Sometimes if we want to describe “each employee must work for exactly one department”, then we would like to describe this constrain in the schema The cardinality ratio for a binary relationship specifies the max number of relationship instances that an entity can participate in. For example---in the Works_for binary relationship, DEPARTMENT:EMPLOYEE is of cardinality ration 1:N, meaning each department can be related to any number of employees, but an employee can only be related to one department

Relationship between EMPLOYEE and DEPARTMENT

cardinality ratio The possible cardinality ratio for binary relationships are 1:1, 1:N, N:1, M:N Example: 1:1 Manages relationship between employee and department M:N an employee can work on several projects and a project can have several employees

Constraints on Relationship Types: Cardinality Ratios Cardinality ratio - specifies number of relationship instances that an entity may participate in. Possible ratios - 1:1, 1:N, M:N M and N can be thought of as "1 or more"

Cardinality ratios (cont.) Faculty Departments Chairs 1 A single faculty member would chair one department (at most). A single department would be chaired by one faculty member.

Cardinality ratios (cont.) Computers Departments AssignedTo N 1 A single computer would be assigned to a single department. A single department could have multiple computers assigned to it.

Cardinality ratios (cont.) Students Sections EnrolledIn M N A single student could be enrolled in multiple sections. A single section would have multiple students enrolled in it.

Cardinality ratios (cont.) States Cities CapitolOf 1 Orders Customers OrderedBy N 1 Movies Customers RecommendedFor M N

ER DIAGRAM