0% found this document useful (0 votes)
61 views63 pages

Ch07 ER Model

Uploaded by

Rinkal Prajapati
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
61 views63 pages

Ch07 ER Model

Uploaded by

Rinkal Prajapati
Copyright
© © All Rights Reserved
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/ 63

CS425 – Summer 2016

Jason Arnold
Chapter 7: Entity-Relationship Model

Partially taken from


Klaus R. Dittrich

modified from:
Database System Concepts, 6th Ed.
©Silberschatz, Korth and Sudarshan
See www.db-book.com for conditions on re-use
Requirement Analysis Example
Zoo
n The zoo stores information about animals, cages, and zoo keepers.
n Animals are of a certain species and have a name. For each animal
we want to record its weight and age.
n Each cage is located in a section of the zoo. Cages can house
animals, but there may be cages that are currently empty. Cages have
a size in square meter.
n Zoo keepers are identified by their social security number. We store a
first name, last name, and for each zoo keeper. Zoo keepers are
assigned to cages they have to take care of (clean, …). Each cage
that is not empty has a zoo keeper assigned to it. A zoo keeper can
take care of several cages. Each zoo keeper takes care of at least one
cage.

CS425 – Fall 2013 – Boris Glavic 7.2 ©Silberschatz, Korth and Sudarshan
Modeling – ER model

n A database can be modeled as:


l a collection of entities,
l relationship among entities.
n An entity is an object that exists and is distinguishable from other
objects.
l Example: specific person, company, event, plant
n Entities have attributes
l Example: people have names and addresses
n An entity set is a set of entities of the same type that share the same
properties.
l Example: set of all persons, companies, trees, holidays

CS425 – Fall 2013 – Boris Glavic 7.3 ©Silberschatz, Korth and Sudarshan
Entity Sets instructor and student

instructor_ID instructor_name student-ID student_name

CS425 – Fall 2013 – Boris Glavic 7.4 ©Silberschatz, Korth and Sudarshan
Relationship Sets

n A relationship is an association among several entities


Example:
44553 (Peltier) advisor 22222 (Einstein)
student entity relationship set instructor entity
n A relationship set is a mathematical relation among n  2 entities, each
taken from entity sets
{(e1, e2, … en) | e1  E1, e2  E2, …, en  En}

where (e1, e2, …, en) is a relationship


l Example:
(44553,22222)  advisor

CS425 – Fall 2013 – Boris Glavic 7.5 ©Silberschatz, Korth and Sudarshan
Relationship Set advisor

CS425 – Fall 2013 – Boris Glavic 7.6 ©Silberschatz, Korth and Sudarshan
Relationship Sets (Cont.)

n An attribute can also be property of a relationship set.


n For instance, the advisor relationship set between entity sets
instructor and student may have the attribute date which tracks when
the student started being associated with the advisor

76766 Crick 98988 Tanaka


45565 Katz 3 May 2008 12345 Shankar
10 June 2007
10101 Srinivasan 00128 Zhang
12 June 2006

98345 Kim 6 June 2009 76543 Brown


76543 Singh 30 June 2007
76653 Aoi
31 May 2007
22222 Einstein 23121 Chavez
4 May 2006

instructor 44553 Peltier

student

CS425 – Fall 2013 – Boris Glavic 7.7 ©Silberschatz, Korth and Sudarshan
Degree of a Relationship Set
n binary relationship
l involve two entity sets (or degree two).
n Relationships between more than two entity sets are rare. Most
relationships are binary. (More on this later.)
 Example: students work on research projects under the
guidance of an instructor.
 relationship proj_guide is a ternary relationship between
instructor, student, and project

CS425 – Fall 2013 – Boris Glavic 7.8 ©Silberschatz, Korth and Sudarshan
Attributes

n An entity is represented by a set of attributes, that are descriptive


properties possessed by all members of an entity set.
l Example:
instructor = (ID, name, street, city, salary )
course= (course_id, title, credits)
n Domain – the set of permitted values for each attribute
n Attribute types:
l Simple and composite attributes.
l Single-valued and multivalued attributes
 Example: multivalued attribute: phone_numbers
l Derived attributes
 Can be computed from other attributes
 Example: age, given date_of_birth

CS425 – Fall 2013 – Boris Glavic 7.9 ©Silberschatz, Korth and Sudarshan
Composite Attributes

composite name address


attributes

first_name middle_initial last_name street city state postal_code

component
attributes
street_number street_name apartment_number

CS425 – Fall 2013 – Boris Glavic 7.10 ©Silberschatz, Korth and Sudarshan
Mapping Cardinality Constraints
n Express the number of entities to which another entity can be
associated via a relationship set.
n For a binary relationship set the mapping cardinality must be one of
the following types:
l One to one (1-1)
l One to many (1-N)
l Many to one (N-1)
l Many to many (N-M)

CS425 – Fall 2013 – Boris Glavic 7.11 ©Silberschatz, Korth and Sudarshan
Mapping Cardinalities

One to one One to many

Note: Some elements in A and B may not be mapped to any


elements in the other set

CS425 – Fall 2013 – Boris Glavic 7.12 ©Silberschatz, Korth and Sudarshan
Mapping Cardinalities Example
Person Birth Advisor Student
certificate

One to one One to many

Note: Some elements in A and B may not be mapped to any


elements in the other set

CS425 – Fall 2013 – Boris Glavic 7.13 ©Silberschatz, Korth and Sudarshan
Mapping Cardinalities Example
Employee Department Student Course

Many to Many to many


one
Note: Some elements in A and B may not be mapped to any
elements in the other set

CS425 – Fall 2013 – Boris Glavic 7.14 ©Silberschatz, Korth and Sudarshan
Mapping Cardinality Constraints Cont.
n What if we allow some elements to not be mapped to another
element?
l E.g., 0:1 – 1
n For a binary relationship set the mapping cardinality must be one of
the following types:

n 1-1 n N-1
l 1-1 l N-1
l 0:1-1 l N-0:1
l 1-0:1 l 0:N-1
l 0:1-0:1 l 0:N-0:1
n 1-N n N-M
l 0:1-N l N-M
l 0:1-0:N l N-0:M
l 1-N l 0:N-M
l 1-0:N l 0:N-0:M

CS425 – Fall 2013 – Boris Glavic 7.15 ©Silberschatz, Korth and Sudarshan
Mapping Cardinality Constraints Cont.
n Typical Notation
l (0:1) – (1:N)

CS425 – Fall 2013 – Boris Glavic 7.16 ©Silberschatz, Korth and Sudarshan
Keys

n A super key of an entity set is a set of one or more attributes


whose values uniquely determine each entity.
n A candidate key of an entity set is a minimal super key
l ID is candidate key of instructor
l course_id is candidate key of course
n Although several candidate keys may exist, one of the candidate
keys is selected to be the primary key.

n Note: Basically the same as for relational model

CS425 – Fall 2013 – Boris Glavic 7.17 ©Silberschatz, Korth and Sudarshan
Keys for Relationship Sets

n The combination of primary keys of the participating entity sets


forms a super key of a relationship set.
l (s_id, i_id) is the super key of advisor
l NOTE: this means a pair of entities can have at most one
relationship in a particular relationship set.
 Example: if we wish to track multiple meeting dates between
a student and her advisor, we cannot assume a relationship
for each meeting. We can use a multivalued attribute
though or model meeting as a separate entity
n Must consider the mapping cardinality of the relationship set when
deciding what are the candidate keys
n Need to consider semantics of relationship set in selecting the
primary key in case of more than one candidate key

CS425 – Fall 2013 – Boris Glavic 7.18 ©Silberschatz, Korth and Sudarshan
Keys for Relationship Sets Cont.

n Must consider the mapping cardinality of the relationship set when


deciding what are the candidate keys
l 1-1: both primary keys are candidate keys
 Example: hasBc: (Person-Birthcertificate)
l N-1: the N side is the candidate key
 Example: worksFor: (Instructor-Department)
l N-M: the combination of both primary keys
 Example: takes: (Student-Course)

CS425 – Fall 2013 – Boris Glavic 7.19 ©Silberschatz, Korth and Sudarshan
Redundant Attributes
n Suppose we have entity sets
l instructor, with attributes including dept_name
l department
and a relationship
l inst_dept relating instructor and department
n Attribute dept_name in entity instructor is redundant since there is an
explicit relationship inst_dept which relates instructors to departments
l The attribute replicates information present in the relationship, and
should be removed from instructor
l BUT: when converting back to tables, in some cases the attribute
gets reintroduced, as we will see.

CS425 – Fall 2013 – Boris Glavic 7.20 ©Silberschatz, Korth and Sudarshan
E-R Diagrams

n Rectangles represent entity sets.


n Diamonds represent relationship sets.
n Attributes listed inside entity rectangle
n Underline indicates primary key attributes

CS425 – Fall 2013 – Boris Glavic 7.21 ©Silberschatz, Korth and Sudarshan
Entity With Composite, Multivalued, and Derived
Attributes

CS425 – Fall 2013 – Boris Glavic 7.22 ©Silberschatz, Korth and Sudarshan
Entity With Composite, Multivalued, and Derived
Attributes

composite

derived

Multi-valued

CS425 – Fall 2013 – Boris Glavic 7.23 ©Silberschatz, Korth and Sudarshan
Relationship Sets with Attributes

CS425 – Fall 2013 – Boris Glavic 7.24 ©Silberschatz, Korth and Sudarshan
Roles

n Entity sets of a relationship need not be distinct


l Each occurrence of an entity set plays a “role” in the relationship
n The labels “course_id” and “prereq_id” are called roles.

CS425 – Fall 2013 – Boris Glavic 7.25 ©Silberschatz, Korth and Sudarshan
Cardinality Constraints

n We express cardinality constraints by drawing either a directed line


(), signifying “one,” or an undirected line (—), signifying “many,”
between the relationship set and the entity set.
n One-to-one relationship:
l A student is associated with at most one instructor via the
relationship advisor
l A student is associated with at most one department via
stud_dept

CS425 – Fall 2013 – Boris Glavic 7.26 ©Silberschatz, Korth and Sudarshan
One-to-One Relationship

n one-to-one relationship between an instructor and a student


l an instructor is associated with at most one student via advisor
l and a student is associated with at most one instructor via
advisor

CS425 – Fall 2013 – Boris Glavic 7.27 ©Silberschatz, Korth and Sudarshan
One-to-Many Relationship

n one-to-many relationship between an instructor and a student


l an instructor is associated with several (including 0) students
via advisor
l a student is associated with at most one instructor via advisor,

CS425 – Fall 2013 – Boris Glavic 7.28 ©Silberschatz, Korth and Sudarshan
Many-to-One Relationships

n In a many-to-one relationship between an instructor and a student,


l an instructor is associated with at most one student via
advisor,
l and a student is associated with several (including 0)
instructors via advisor

CS425 – Fall 2013 – Boris Glavic 7.29 ©Silberschatz, Korth and Sudarshan
Many-to-Many Relationship
n An instructor is associated with several (possibly 0) students via
advisor
n A student is associated with several (possibly 0) instructors via
advisor

CS425 – Fall 2013 – Boris Glavic 7.30 ©Silberschatz, Korth and Sudarshan
Participation of an Entity Set in a
Relationship Set
n Total participation (indicated by double line): every entity in the
entity set participates in at least one relationship in the relationship
set
l E.g., participation of section in sec_course is total
 every section must have an associated course
n Partial participation: some entities may not participate in any
relationship in the relationship set
l Example: participation of instructor in advisor is partial

CS425 – Fall 2013 – Boris Glavic 7.31 ©Silberschatz, Korth and Sudarshan
Alternative Notation for Cardinality Limits

n Cardinality limits can also express participation constraints

CS425 – Fall 2013 – Boris Glavic 7.32 ©Silberschatz, Korth and Sudarshan
Alternative Notation for Cardinality Limits

n Alternative Notation

(0,n) (1,1)

CS425 – Fall 2013 – Boris Glavic 7.33 ©Silberschatz, Korth and Sudarshan
E-R Diagram with a Ternary Relationship

CS425 – Fall 2013 – Boris Glavic 7.34 ©Silberschatz, Korth and Sudarshan
Cardinality Constraints on Ternary
Relationship
n We allow at most one arrow out of a ternary (or greater degree)
relationship to indicate a cardinality constraint
n E.g., an arrow from proj_guide to instructor indicates each student has
at most one guide for a project
n If there is more than one arrow, there are two ways of defining the
meaning.
l E.g., a ternary relationship R between A, B and C with arrows to B
and C could mean
1. each A entity is associated with a unique entity from B and C or
2. each pair of entities from (A, B) is associated with a unique C
entity, and each pair (A, C) is associated with a unique B
l Each alternative has been used in different formalisms
l To avoid confusion we outlaw more than one arrow
n Better to use cardinality constraints such as (0,n)

CS425 – Fall 2013 – Boris Glavic 7.35 ©Silberschatz, Korth and Sudarshan
Weak Entity Sets

n An entity set that does not have a primary key is referred to as a


weak entity set.
n The existence of a weak entity set depends on the existence of a
identifying entity set
l It must relate to the identifying entity set via a total, one-to-many
relationship set from the identifying to the weak entity set
l Identifying relationship depicted using a double diamond
n The discriminator (or partial key) of a weak entity set is the set of
attributes that distinguishes among all the entities of a weak entity
set that are associated with the same entity of the identifying entity
set
n The primary key of a weak entity set is formed by the primary key of
the strong entity set on which the weak entity set is existence
dependent, plus the weak entity set’s discriminator.

CS425 – Fall 2013 – Boris Glavic 7.36 ©Silberschatz, Korth and Sudarshan
Weak Entity Sets (Cont.)
n We underline the discriminator of a weak entity set with a dashed
line.
n We put the identifying relationship of a weak entity in a double
diamond.
n Primary key for section – (course_id, sec_id, semester, year)

CS425 – Fall 2013 – Boris Glavic 7.37 ©Silberschatz, Korth and Sudarshan
Weak Entity Sets (Cont.)
n Note: the primary key of the strong entity set is not explicitly stored
with the weak entity set, since it is implicit in the identifying
relationship.
n If course_id were explicitly stored, section could be made a strong
entity, but then the relationship between section and course would
be duplicated by an implicit relationship defined by the attribute
course_id common to course and section

CS425 – Fall 2013 – Boris Glavic 7.38 ©Silberschatz, Korth and Sudarshan
E-R Diagram for a University Enterprise

CS425 – Fall 2013 – Boris Glavic 7.39 ©Silberschatz, Korth and Sudarshan
Reduction to Relational Schemas

CS425 – Fall 2013 – Boris Glavic 7.40 ©Silberschatz, Korth and Sudarshan
Representing Entity Sets With Simple
Attributes

n A strong entity set reduces to a schema with the same attributes


student(ID, name, tot_cred)
n A weak entity set becomes a table that includes a column for the primary
key of the identifying strong entity set
section ( course_id, sec_id, sem, year )

CS425 – Fall 2013 – Boris Glavic 7.41 ©Silberschatz, Korth and Sudarshan
Representing Relationship Sets

n A many-to-many relationship set is represented as a schema with


attributes for the primary keys of the two participating entity sets, and any
descriptive attributes of the relationship set.
n Example: schema for relationship set advisor
advisor = (s_id, i_id)

CS425 – Fall 2013 – Boris Glavic 7.42 ©Silberschatz, Korth and Sudarshan
Redundancy of Schemas
n Many-to-one and one-to-many relationship sets that are total on the
many-side can be represented by adding an extra attribute to the
“many” side, containing the primary key of the “one” side
n Example: Instead of creating a schema for relationship set inst_dept,
add an attribute dept_name to the schema arising from entity set
instructor

CS425 – Fall 2013 – Boris Glavic 7.43 ©Silberschatz, Korth and Sudarshan
Redundancy of Schemas (Cont.)

n For one-to-one relationship sets, either side can be chosen to act


as the “many” side
l That is, extra attribute can be added to either of the tables
corresponding to the two entity sets
l If the relationship is total in both sides, the relation schemas
from the two sides can be merged into one schema
n If participation is partial on the “many” side, replacing a schema by
an extra attribute in the schema corresponding to the “many” side
could result in null values
n The schema corresponding to a relationship set linking a weak
entity set to its identifying strong entity set is redundant.
l Example: The section schema already contains the attributes
that would appear in the sec_course schema

CS425 – Fall 2013 – Boris Glavic 7.44 ©Silberschatz, Korth and Sudarshan
Composite and Multivalued Attributes

n Composite attributes are flattened out by creating a


separate attribute for each component attribute
l Example: given entity set instructor with
composite attribute name with component
attributes first_name and last_name the schema
corresponding to the entity set has two attributes
name_first_name and name_last_name
 Prefix omitted if there is no ambiguity
n Ignoring multivalued attributes, extended instructor
schema is
l instructor(ID,
first_name, middle_initial, last_name,
street_number, street_name,
apt_number, city, state, zip_code,
date_of_birth)

CS425 – Fall 2013 – Boris Glavic 7.45 ©Silberschatz, Korth and Sudarshan
Composite and Multivalued Attributes

n A multivalued attribute M of an entity E is represented by a separate


schema EM
l Schema EM has attributes corresponding to the primary key of E
and an attribute corresponding to multivalued attribute M
l Example: Multivalued attribute phone_number of instructor is
represented by a schema:
inst_phone= ( ID, phone_number)
l Each value of the multivalued attribute maps to a separate tuple of
the relation on schema EM
 For example, an instructor entity with primary key 22222 and
phone numbers 456-7890 and 123-4567 maps to two tuples:
(22222, 456-7890) and (22222, 123-4567)

CS425 – Fall 2013 – Boris Glavic 7.46 ©Silberschatz, Korth and Sudarshan
Multivalued Attributes (Cont.)
n Special case:entity time_slot has only one attribute other than the
primary-key attribute, and that attribute is multivalued
l Optimization: Don’t create the relation corresponding to the entity,
just create the one corresponding to the multivalued attribute
l time_slot(time_slot_id, day, start_time, end_time)
l Caveat: time_slot attribute of section (from sec_time_slot) cannot be
a foreign key due to this optimization

CS425 – Fall 2013 – Boris Glavic 7.47 ©Silberschatz, Korth and Sudarshan
Design Issues
n Use of entity sets vs. attributes

n Designing phone as an entity allow for primary key constraints for phone
n Designing phone as an entity allow phone numbers to be used in
relationships with other entities (e.g., student)
n Use of phone as an entity allows extra information about phone numbers

CS425 – Fall 2013 – Boris Glavic 7.48 ©Silberschatz, Korth and Sudarshan
Design Issues
n Use of entity sets vs. relationship sets
l Possible guideline is to designate a relationship set to describe an
action that occurs between entities
l Possible hint: the relationship only relates entities, but does not have an
existence by itself. E.g., hasAddress: (department-address)

CS425 – Fall 2013 – Boris Glavic 7.49 ©Silberschatz, Korth and Sudarshan
Design Issues
n Binary versus n-ary relationship sets
l Although it is possible to replace any nonbinary (n-ary, for n > 2)
relationship set by a number of distinct binary relationship sets + an
aritifical entity set, a n-ary relationship set shows more clearly that
several entities participate in a single relationship.

CS425 – Fall 2013 – Boris Glavic 7.50 ©Silberschatz, Korth and Sudarshan
Binary Vs. Non-Binary Relationships

n Some relationships that appear to be non-binary may be better


represented using binary relationships
l E.g., A ternary relationship parents, relating a child to his/her
father and mother, is best replaced by two binary relationships,
father and mother
l But there are some relationships that are naturally non-binary
 Example: proj_guide

CS425 – Fall 2013 – Boris Glavic 7.51 ©Silberschatz, Korth and Sudarshan
Converting Non-Binary Relationships to Binary Form

n In general, any non-binary relationship can be represented using


binary relationships by creating an artificial entity set.
l Replace R between entity sets A, B and C by an entity set E, and
three relationship sets:
1. RA, relating E and A 2. RB, relating E and B
3. RC, relating E and C
l Create a special identifying attribute for E
l Add any attributes of R to E
l For each relationship (ai , bi , ci) in R, create
1. a new entity ei in the entity set E 2. add (ei , ai ) to RA
3. add (ei , bi ) to RB 4. add (ei , ci ) to RC

CS425 – Fall 2013 – Boris Glavic 7.52 ©Silberschatz, Korth and Sudarshan
ER-model to Relational Summary
n Rule 1) Strong entity E
l Create relation with attributes of E
l Primary key is equal to the PK of E
n Rule 2) Weak entity W identified by E through relationship R
l Create relation with attributes of W and R and PK(E).
l Set PK to discriminator attributes combined with PK(E). PK(E) is a
foreign key to E.
n Rule 3) Binary relationship R between A and B: one-to-one
l If no side is total add PK of A to as foreign key in B or the other
way around. Add any attributes of the relationship R to A
respective B.
l If one side is total add PK of the other-side as foreign key. Add any
attributes of the relationship R to the total side.
l If both sides are total merge the two relation into a new relation E
and choose either PK(A) as PK(B) as the new PK. Add any
attributes of the relationship R to the new relation E.

CS425 – Fall 2013 – Boris Glavic 7.53 ©Silberschatz, Korth and Sudarshan
ER-model to Relational Summary (Cont.)
n Rule 4) Binary relationship R between A and B: one-to-many/many-to-
one
l Add PK of the “one” side as foreign key to the “many” side.
l Add any attributes of the relationship R to the “many” side.
n Rule 5) Binary relationship R between A and B: many-to-many
l Create a new relation R.
l Add PK’s of A and B as attributes + plus all attributes of R.
l The primary key of the relationship is PK(A) + PK(B). The PK
attributes of A/B form a foreign key to A/B
n Rule 6) N-ary relationship R between E1 … En
l Create a new relation.
l Add all the PK’s of E1 … En. Add all attributes of R to the new
relation.
l The primary key or R is PK(E1) … PK(En). Each PK(Ei) is a foreign
key to the corresponding relation.

CS425 – Fall 2013 – Boris Glavic 7.54 ©Silberschatz, Korth and Sudarshan
ER-model to Relational Summary (Cont.)
n Rule 7) Entity E with multi-valued attribute A
l Create new relation. Add A and PK(E) as attributes.
l PK is all attributes. PK(E) is a foreign key.

CS425 – Fall 2013 – Boris Glavic 7.55 ©Silberschatz, Korth and Sudarshan
E-R Diagram for a University Enterprise

CS425 – Fall 2013 – Boris Glavic 7.56 ©Silberschatz, Korth and Sudarshan
Translate the University ER-Model
n Rule 1) Strong Entities
l department(dept_name, building, budget)
l instructor(ID, name, salary)
l student(ID, name, tot_cred)
l course(course_id, title, credits)
l time_slot(time_slot_id)
l classroom(building,room_number, capacity)
n Rule 2) Weak Entities
l section(course_id, sec_id, semester, year)

CS425 – Fall 2013 – Boris Glavic 7.57 ©Silberschatz, Korth and Sudarshan
Translate the University ER-Model
n Rule 3) Relationships one-to-one
l None exist

n Rule 4) Relationships one-to-many


l department(dept_name, building, budget)
l instructor(ID, name, salary, dept_name)
l student(ID, name, tot_cred, dept_name, instr_ID)
l course(course_id, title, credits, dept_name)
l time_slot(time_slot_id)
l classroom(building,room_number, capacity)
l section(course_id, sec_id, semester, year, room_building,
room_number, time_slot_id)

CS425 – Fall 2013 – Boris Glavic 7.58 ©Silberschatz, Korth and Sudarshan
Translate the University ER-Model

n Rule 5) Relationships many-to-many


l department(dept_name, building, budget)
l instructor(ID, name, salary, dept_name)
l student(ID, name, tot_cred, dept_name, instr_ID)
l course(course_id, title, credits, dept_name)
l time_slot(time_slot_id)
l classroom(building,room_number, capacity)
l section(course_id, sec_id, semester, year,
room_building, room_number, time_slot_id)
l prereq(course_id, prereq_id)
l teaches(ID, course_id, sec_id, semester, year)
l takes(ID, course_id, sec_id, semester, year, grade)
n Rule 6) N-ary Relationships
l none exist

CS425 – Fall 2013 – Boris Glavic 7.59 ©Silberschatz, Korth and Sudarshan
Translate the University ER-Model
n Rule 7) Multivalued attributes
l department(dept_name, building, budget)
l instructor(ID, name, salary, dept_name)
l student(ID, name, tot_cred, dept_name, instr_ID)
l course(course_id, title, credits, dept_name)
l time_slot(time_slot_id)
l time_slot_day(time_slot_id, start_time, end_time)
l classroom(building,room_number, capacity)
l section(course_id, sec_id, semester, year,
room_building, room_number, time_slot_id)
l prereq(course_id, prereq_id)
l teaches(ID, course_id, sec_id, semester, year)
l takes(ID, course_id, sec_id, semester, year, grade)

CS425 – Fall 2013 – Boris Glavic 7.60 ©Silberschatz, Korth and Sudarshan
ER Design Decisions
n The use of an attribute or entity set to represent an object.
n Whether a real-world concept is best expressed by an entity set or
a relationship set.
n The use of a ternary relationship versus a pair of binary
relationships.
n The use of a strong or weak entity set.
n The use of specialization/generalization – contributes to modularity
in the design.
n The use of aggregation – can treat the aggregate entity set as a
single unit without concern for the details of its internal structure.

CS425 – Fall 2013 – Boris Glavic 7.61 ©Silberschatz, Korth and Sudarshan
Summary of Symbols Used in E-R Notation

CS425 – Fall 2013 – Boris Glavic 7.62 ©Silberschatz, Korth and Sudarshan
End of Chapter 7

Partially taken from


Klaus R. Dittrich

modified from:
Database System Concepts, 6th Ed.
©Silberschatz, Korth and Sudarshan
See www.db-book.com for conditions on re-use

You might also like