The document discusses the Entity-Relationship (ER) data model. The ER model represents real-world entities and relationships between entities in a database. It uses entities, relationships, and attributes. Entities are represented as rectangles, relationships as diamonds connected to entities. Attributes of entities and relationships are shown inside these shapes. The document provides examples of different types of relationships, like binary, unary, and ternary relationships. It also describes the properties of entities, relationships, and attributes in an ER diagram.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
108 views19 pages
ER Model (Database Management)
The document discusses the Entity-Relationship (ER) data model. The ER model represents real-world entities and relationships between entities in a database. It uses entities, relationships, and attributes. Entities are represented as rectangles, relationships as diamonds connected to entities. Attributes of entities and relationships are shown inside these shapes. The document provides examples of different types of relationships, like binary, unary, and ternary relationships. It also describes the properties of entities, relationships, and attributes in an ER diagram.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19
ER MODEL
Instructor : Nitesh Kumar Jha
[email protected] ITER,S’O’A(DEEMED TO BE UNIVERSITY) July 2018 Review
The ER Model
Introduction to databases 1.2
Content
The ER Model The ER Diagram
Introduction to databases 1.3
Entity-Relationship (ER) Data Model The ER data model facilitates database design by allowing specification of an enterprise schema that represents the overall logical structure of a database. It is very useful in mapping the meanings and interactions of real-world enterprises onto a conceptual schema. The ER data model employs three basic concepts: Entity Sets, Relationship Sets, Attributes. The ER model also has an associated diagrammatic representation, the ER diagram, which can express the overall logical structure of a database graphically. Introduction to databases 1.4 ER Data Model - II This data model uses a collection of basic objects, called entities, and relationships among these objects. An entity is a “thing” or “object” in the real world that is distinguishable from other objects. Ex: employee, student, account An entity has a set of properties that uniquely identifies an entity called attributes. Ex: Employee (emp_no, emp_name, …) Student (stu_no, stu_name, branch, …)
Introduction to databases 1.5
ER Model: Entity Set Entity Set : is a set of entities of the same type that share the same attributes. Ex: The set of all people who are instructors at a given university, can be defined as the entity set instructor.
Ex: The set of all students at a given university, can be defined
as the entity set student.
Introduction to databases 1.6
ER Diagram: Entity Set Entities are represented graphically as follows: Rectangles represent entity sets. Part I: entity set name Part II: Attributes listed inside entity rectangle Underline indicates primary key attributes
Introduction to databases 1.7
ER Model: Relationship - I Relationship: A relationship is an association among several entities. Ex: Let’s define a relationship advisor that associates instructor Katz with student Shankar. Relationship set: is a set of relationships of same type between two or more entity sets.
Relationship set advisor
Introduction to databases 1.8
ER Model: Relationship Set - II The association between entity sets is referred to as participation. Ex: Katz and Shankar participate in relationship instance of advisor i.e. This relationship instance represents that in the university, instructor Katz is advising student Shankar. Relationship may also have attributes called descriptive attributes.. Ex. the advisor relationship set between entity sets instructor and student have the attribute date which tracks when the student started being associated with the advisor Introduction to databases 1.9 ER Diagram: Relationship sets Diamonds represent relationship sets Solid lines link entity set to relationship sets
Relationship sets with attributes
Undivided rectangles represent attributes of relationship set Dashed line link relationship set to attributes
Introduction to databases 1.10
Project-I – Step I Entity set Customer with attributes cust_num, Name , Address, Phone_num Entity set Account with attributes Acc_num, balance Entity set Loan with attributes loan_num, Loan_amt Entity set Branch with attributes branch_id, branch_name, branch_address Relationship set Deposits between Customer & Account Relationship set Borrows between Customer & Loan Relationship set Loan_branch between Loan & Branch Relationship set Account_with between Account & Branch
Introduction to databases 1.11
ER Model: Relationship Set - III The function that an entity plays in a relationship is called that entity’s role Katz’s role is ‘instructor’, Shankar’s is ‘student’ in the relationship of ‘advisor’ The same entity set participates in a relationship set more than once, in different roles is called recursive relationship set Also known as unary relationship
MTH 1001: Calculus I
prerequisite MTH 2001: Calculus II recursive relationship set Role of MTH2001: course CSE1002: Discrete Maths Role of MTH1001: prerequisite CSE2011: COA course
MTH2002: Probability & Statistics
Introduction to databases 1.12 ER Model: Degree of Relationship The degree of a relationship set is the number of entity sets participate in the relationship. The three most common relationship sets categorised according to the degree in ER models are Binary: When two entity sets participates. Ex: Teacher teaches some Students Unary: when both participants are the same entity Ex: Subject prerequisite of another Subject Also known as recursive relation Ternary: when three entities participate in the relationship. Ex1: Instructor becomes project_guide to students and develops projects Ex2: Teacher teaching_activity with Branch and Subject Introduction to databases 1.13 ER Diagram: Degree of Relationship subject sub_id sub_id title prerequisite project credits prereq_id ... Unary: The labels “sub_id” and instructor student “prereq_id” are called roles. ID ID proj_guide name name salary tot_cred subject ... teacher branch Ternary: 3 entity sets ID ID participate in a name teaching_ activity name tot_cred relationship set salary Introduction to databases 1.14 ER Model: Attributes Attributes are the properties of an entity set that are relevant to the database and about which the data values need to be stored. For each attribute, there is a set of permitted values, called domain or value set An attribute of an entity set is a function that maps from the entity set in to a domain. Each entity can be described by a set of (attribute, value) pair. Ex. A particular instructor entity may be represented as {(ID, 76766), (name, Crick), (dept, CSIT), (salary, 50000)} Similarly a particular student entity {(ID, 34721),(name, Sid),(DoB, 30-12-1997),(branch, CSIT)}
Introduction to databases 1.15
ER Model: Category of Attributes- I Simple and Composite Simple attributes are atomic and cannot be divided further. Ex. (regNo) Composite attributes are sub-divided further. Ex. (name{first_name, middle_name, last_name}) Composite attributes may be represented in a hierarchy.
Composite attributes are useful when it is needed to use either
whole or part of the information of an attribute Introduction to databases 1.16 ER Model: Category of Attributes- II Single Valued and Multivalued Attribute that maps to only one value in a domain are called single valued attribute Ex. DoB, reg_no Attribute that maps to more than one values in a domain are called multivalued attribute. Ex. phone_no, email_id Derived If the value for an attribute can be computed from the values of other related attributes then is called derived attribute Ex. age, net_salary, can be calculated from DoB and other salary components respectively.
Introduction to databases 1.17
ER Diagram: Attributes Composite attribute: represented in indentation. Ex. name with component attributes first_name,…, last_name Ex. address with , city, state, and zip. Ex. street with street_no, street name and apt_number Multivalued attribute: represented using curly braces. Ex. {phone_number} of instructor Derived attribute: represented using parenthesis. Ex. age( ) Introduction to databases 1.18 Thank You