0% found this document useful (0 votes)
27 views34 pages

DBS Lecture#10-12

The document discusses relationship types, cardinality, degree of relationships, and special cases in entity relationship diagrams including associative entities, multiple relationships, attributes on relationships, and ternary relationships.

Uploaded by

Connor Muench
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views34 pages

DBS Lecture#10-12

The document discusses relationship types, cardinality, degree of relationships, and special cases in entity relationship diagrams including associative entities, multiple relationships, attributes on relationships, and ternary relationships.

Uploaded by

Connor Muench
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 34

In the Last Lecture

• Relationship type and Relationship Instance


• Relationship
• Degree of Relationship
• Cardinality of Relationship
• Degree of Relationship (Unary, Binary, Ternary,
Higher Degree)
• Cardinality Types
• Minimum Cardinality
• Maximum Cardinality

• 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

Employee ID Completes Course_ID


Employee_Name Course_Title
Associative Entity
The presence of one or more
attributes on a relationship suggest
to the designer that the relationship
should be represented as entity type
This type of entity known as
Associative Entity
Date_Completed

A B
EMPLOYEE COURSE
Employee ID Course_ID
Employee_Name Completes Course_Title

EMPLOYEE A Certificate B COURSE


Employee ID Certificate_No Course_ID
Employee_Name Date_Completed B
Course_Title
Associative Entity
Associative entities sometimes referred
as gerunds
The relationship name(verb) usually
converted into entity name that is
noun(or -ing form of the verb)
There is no relationship
Associative Entity in Visio
When to make Associative Entity
We will convert a relationship into Associative Entity if
following situation exists:
Relationship cardinality is many-to-many
Associative entity has independent meaning for
end user
The associative entity involve in one or more
relationships independent to the entities related
to the associative entities
The relationship has one or more attributes
including identifier
Associative Entity

STUDENT REGISTRATION COURSE


Student ID Grade Course_ID
Name Semester Course_Title
Address B
Year
Major
Multiple Relationship
Sometime, organization wishes to
establish more than one relationship
between entity types
This kind of relationship is known as
Multiple Relationship
Multiple Relationship

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

You might also like