Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Lavika Goel
Assistant Professor
BITS Pilani Department of CSIS
Lecture 2: 27/7/2019
Pilani Campus
Hyderabad Campus
BITS Pilani
Hyderabad Campus
Pilani Campus
Design Process
Modeling
Constraints
E-R Diagram
Design Issues
Weak Entity Sets
Extended E-R Features
Design of the Bank Database
ID name ID name
If all foreign key constraints are enforced, referential integrity is achieved (i.e.,
no dangling references.)
Enrolled
sid cid grade Students
sid name login age gpa
53666 Carnatic101 C
53666 Jones jones@cs 18 3.4
53666 Reggae203 B
53688 Smith smith@eecs 18 3.2
53650 Topology112 A
53666 History105 B 53650 Smith smith@math 19 3.8
11111 English102 A
Database Design and Applications (CSI ZG518/ SSZG518) Pilani Campus
BITS Pilani, Hyderabad Campus
Relationship Sets
A relationship is an association among several entities
Example:
44553 (Peltier) advisor 22222 (Einstein)
student entity relationship set instructor entity
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}
Example:
(44553,22222) advisor
There can be more than one relationship set involving the same entity sets.
In case the relationship also has attributes, the following set of attributes describe an individual
relationship:
composite
multivalued
derived
We allow at most one arrow out of a ternary (or greater degree) relationship to indicate
a cardinality constraint
E.g., an arrow from proj_guide to instructor indicates each student has at most one
guide for a project
If there is more than one arrow, there are two ways of defining the meaning.
– 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
– Each alternative has been used in different formalisms
– To avoid confusion we outlaw more than one arrow
An entity set that does not have a primary key is referred to as a weak entity set.
The existence of a weak entity set depends on the existence of a identifying
entity set
– it must relate to the identifying entity set via a total, many-to-one relationship set
from the weak entity set to the identifying entity set
– Identifying relationship depicted using a double diamond
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.
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.
Subset of entities within an entity set may have attributes that are not shared by all the entities
in the entity set
Specialization is depicted by a hollow arrow-head pointing from the specialized entity to the
other entity
Overlapping
specialization: entity
may belong to multiple
specialized entity sets
Disjoint specialization:
entity may belong to
at most one
specialized entity set
Top-down design
process
Bottom up process
From employee (ID,name, address, salary) and student (ID, name, address
,cgpa) to person(ID, name, address)
Generalization proceeds from the recognition that a number of entity sets share
some common features.
On the basis of their commonalities, generalization synthesizes these entity
sets into a single, higher-level entity set.
Specialization: single entity set, find differences among entities, create distinct
lower level entity sets that may have additional attributes and may participate
in additional relationships
– Overlapping
• an entity can belong to more than one lower-level entity set
Redundancy??
Database Design and Applications (CSI ZG518/ SSZG518) BITS Pilani, Pilani Campus
Used in recursive relationship sets
Database Design and Applications (CSI ZG518/ SSZG518) BITS Pilani, Pilani Campus
Database Design and Applications (CSI ZG518/ SSZG518) BITS Pilani, Pilani Campus
Database Design and Applications (CSI ZG518/ SSZG518) BITS Pilani, Pilani Campus
E-R Design Decisions
Database Design and Applications (CSI ZG518/ SSZG518) BITS BITS PilaniPilani
Pilani,Pilani,
HyderabadCampusCampus
Relational schema
Database Design and Applications (CSI ZG518/ SSZG518) BITS Pilani, Pilani Campus