DBS Lecture#10-12
DBS Lecture#10-12
• Discovering Cardinality
Degree of Relationship
Manages
Person Is_Married EMPLOYEE
Unary
One-to-
One-to-one
many
Is_assigned
EMPLOYEE PARKING PLACE
Binary
Receives
CUSTOMER INVOICE
PART
VENDOR
Supplies
WAREHOUSE Ternary
Special Cases
Some time we have to handle some
special case in ERD such as:
Attributes on Relationships
Attribute or Relationship
Multiple Relationships
Many to Many Relationships
Ternary Relationship
Attributes on Relationships
Sometimes we have to include attribute with
relationships
Where we include attribute
Date_Completed in following situation
Date_Completed
EMPLOYEE A B COURSE
A B
EMPLOYEE COURSE
Employee ID Course_ID
Employee_Name Completes Course_Title
Works_In
Supervise
EMPLOYE DEPARTMENT
Manages
Exercise
Exercise
Attributes and Relationship
Sometimes we have to convert an
attribute into a relationship
Course_Title
Course_ID Prerequisite
COURSE
Is_
COURSE Prerequisite_
Course ID For
COURSE
Course Title
Course ID
Course Title
{Prerequisite}
Time-Dependent Data
Database contents vary over time
It means attribute values can change as
time goes on
For example Price of PRODUCT
We have to convert the attribute into
composite multi-valued attribute
Time stamp is attached with each
attribute
Time-Dependent Data
Price Effective_Date
Product_ID Price_History
PRODUCT
Many to Many Relationship
Registers
STUDENT COURSE
Many-to-Many
Many-to-Many Relationship
Is_
COURSE Prerequisite_
Course ID For
Course Title
Ternary Relationship
A simultaneous relationship between
the instances of three entities
PART
VENDOR WAREHOUSE
Supplies
Consider attributes Shipping Mode and Unit Cost
Suppose Vendor X supplies part A to the Warehouse
Y using the by sea at 5 Rupees per part
Ternary Relationship
Attribute OR Entity
Attribute OR Entity
Naming Relationship
Relationship is kind of action
Relationship name is verb phrase i.e.
Assigned_to, Supplies, or Teaches
It is usually present tense
Avoid vague names like Has or
Is_related_to
Business Rules
Business rules are derived from:
Policies
Procedures
Events
functions Business rules govern how
data is handled and stored
Business Rules
ERD document rules and policies of
organization that govern data
For example a policy, “every student in
the university must have a faculty
adviser”
Business Rules
The job of the DBA is:
1. Identify and understand those
rules that govern data
2. Represent those rules in proper
notation
3. Implement those rules in database
technology
Business Rules
Data Modeling(ERD) is important tool
in this process
Data Model cannot represent all
business rules
First know as integrity rules
Business Rules
“a student may register for a section of
a course only if he or she has
successfully completed the prerequisites
for that course”
The customer who place one thousand
rupees order will get a coupon for lucky
draw
Good Business Rules
Declarative
Precise
Atomic
Consistent(internally,externally)
Expressible
Distinct
Business oriented
Naming Relationship
Relationship is kind of action
Relationship name is verb phrase i.e.
Assigned_to, Supplies, or Teaches
It is usually present tense
Avoid vague names like Has or
Is_related_to