Lecture3 Dbms
Lecture3 Dbms
Lecture3 Dbms
the Organization
Lecture # 03
SDLC Revisted
Purpose–thorough requirements analysis
Planning and structuring
Deliverable–functional system specifications
Analysis
Analysis
Design
Implementation
Database activity–Thorough
and integrated conceptual Maintenance
data modeling
WHAT ARE BUSINESS
RULES?
• Business rules are derived from policies, procedures, events
functions and other business objects
• They state constraints on the organization
• For example: “ A student may register for a section of a course
only if he or she has successfully completed the prerequisites
for that course”
Business Rules
• Statements that define or constrain some aspect of the
business
• Assert business structure
• Control/influence business behavior
• Expressed in terms familiar to end users
• Automated through DBMS software
A Good Business Rule is:
A special entity
that is also a
relationship
Entity
symbols
Attribute
symbols
Relationship
symbols
Data names and Definitions
• Data objects must be named and defined before
using them in a model. Data names should be :
• Related to business
• Be meaningful
• Be unique
• Be readable
• Be composed of words taken from approved list
• Be repeatable
• Follow a standard syntax
Data definitions
• Explanation of term or fact
• Term is word or phrase having meaning for the business e.g
course, section etc
• Fact is an association between two or more terms. E.g. A
course is module of instruction in particular subject area
What Should an Entity Be?
• SHOULD BE:
• An object that will have many instances in the database
• An object that will be composed of multiple attributes
• An object that we are trying to model
• SHOULD NOT BE:
• A user of the database system
• An output of the database system (e.g. a report)
Inappropriate entities
Figure 3-4
Appropriate entities
Entity types vs Entity
instance
• Collection of entities sharing common properties is entity
type. Is always singular
Multivalued:
Derived
an employee can have
from date employed and current date
more than one skill
Figure 3-19 – an attribute that is both multivalued and composite
This is an
example of time-
stamping
Single-valued Versus Multivalued
Attributes
• For each entity instance, each of the attributes in the figure has one
value.
• there is an attribute that may have more than one value for a given
instance.
• indicate a multivalued attribute with curly brackets around the
attribute
Stored Versus Derived
Attributes
• Some attribute values that are of interest to users can be
calculated or derived from other related attribute values that
are stored in the database.
• indicate a derived attribute with square brackets around the
attribute
• Or some tools use a notation of forward / in front of the
attribute name.
Naming and defining
attributes
• An attribute name is a singular noun or noun phrase
• An attribute name should be unique.
• To make an attribute name unique and for clarity purposes,
each attribute name should follow a standard format.
• Similar attributes of different entity types should use the same
qualifiers and classes such as Faculty Residence City Name
Naming and defining
attributes contd..
• and Student Residence City Name.
• Any aliases, or alternative names, for the attribute can be
specified in the definition, or may be included elsewhere in
documentation
• For a multivalued attribute, the attribute definition should
indicate the maximum
and minimum number of occurrences of an attribute value for an
entity instance.
Naming and defining
attributes contd..
• Read more from the book (Assignment)
Activity-I
• The entity type STUDENT has the following attributes:
• Student Name, Address, Phone, Age, Activity, and No of Years.
Activity represents some campus-based student activity, and No of
Years represents the number of years the student has engaged in
this activity.
• A given student may engage in more than one activity.
• Draw an ERD for this situation. What attribute or attributes did you
designate as the identifier for the STUDENT entity? Why?
Modeling Relationships
• a relationship is an association representing an interaction among
the instances of one or more entity types that is of interest to the
organization.
• a relationship has a verb phrase name.
• Relationships and their characteristics (degree and cardinality)
represent business rules
More on Relationships
• Relationship Types vs. Relationship Instances
• The relationship type is modeled as the diamond and lines
between entity types…the instance is between specific entity
instances
• Relationships can have attributes
• These describe features pertaining to the association between the entities
in the relationship
• Two entities can have more than one type of
relationship between them (multiple relationships)
• Associative Entity = combination of relationship and
entity
• More on this later
Naming and Defining
Relationships
• A relationship name is a verb phrase (such as Assigned To,
Supplies, or Teaches).
• You should avoid vague names, such as Has or Is Related To.
Use descriptive, powerful verb phrases, often taken from the
action verbs found in the definition of the relationship
• Reading assignment
Attributes On Relationships
• attributes may be associated with a many-to-many (or one-to-
one) relationship called as associative entity
• For example,
• suppose the organization wishes to record the date
(month and year) when an employee completes each
course. This attribute is named Date Completed.
Associative entity
• The associative entity CERTIFICATE is represented with the
rectangle with rounded corners
whether to convert a
relationship to an associative
entity type?
• Following are four conditions that should exist:
1.All the relationships for the participating entity types are
“many” relationships.
2.The resulting associative entity type has independent meaning
to end users and can be identified with a single-attribute
identifier.
whether to convert a
relationship to an associative
entity type? Contd..
3. The associative entity has one or more attributes in addition
to the identifier.
4. The associative entity participates in one or more
relationships independent of the entities related in the
associated relationship.
Degree of Relationships
• Degree of a Relationship is the
number of entity types that
participate in it
• Unary Relationship
• Binary Relationship
• Ternary Relationship
Degree of relationships –
One entity
related to Entities of two
another of the different types Entities of three
same entity related to each different types
type other related to each
other
Degree of Relationship
contd..
• Binary Relationship:
Degree of Relationship
contd..
• Ternary Relationship:
• A ternary relationship is a simultaneous relationship among the
instances of three entity types
Cardinality of Relationships
• One – to – One
• Each entity in the relationship will have exactly one
related entity
• One – to – Many
• An entity on one side of the relationship can have
many related entities, but an entity on the other side
will have a maximum of one related entity
• Many – to – Many
• Entities on both sides of the relationship can have
many related entities on the other side
Cardinality Constraints
Here,max
cardinality
constraint is 4
Figure 3-15: Multivalued
attribute vs. relationship.
Alternative approaches
Figure 3-5: Strong and weak entities