Wa0006.
Wa0006.
• or alternatively
• Multivalued composite attribute of PROJECT:
Workers (Employee, Hours).
• We choose the first alternative in Figure 3.8;
Weak Entity Types
• Weak entity types: Entity types that do not have
key attributes of their own and their identification
is dependent on another entity type..
• Strong entity types: that do have a key attribute.
• Always has a total participation constraint
(existence dependency) with respect to its
identifying relationship:
• A weak entity cannot be identified without an owner
entity.
Weak Entity
Constraints on Binary
Relationship Types
• Constraint: each employee must work for exactly
one department.
• Cardinality Ratios for Binary Relationships.
• Maximum number of relationship instances that an
entity can participate in.
• Cardinality Ratio (specifies maximum participation)
• One-to-one (1:1)
• One-to-many (1:N) or
• Many-to-one (N:1)
• Many-to-many (M:N)
• The UNIVERSITY database keeps track of the university’s
operations, including students, professors, departments, and
courses. The university is organized into departments, each
with a unique name and a unique code. Each department is
headed by a professor, and the database records the start
date of the professor’s leadership. Departments are also
associated with multiple buildings where their offices and
classrooms are located.
• Each department offers several courses, each identified by a
unique course code, a title, and a description. Courses also
have a specified number of credits. A course may be taught
by one or more professors and may have multiple sections.
Each section is uniquely identified by a section number and
is assigned a specific room and schedule.
• Professors have a unique employee ID, along with other
information such as their name, address, specialization, and salary.
Professors are assigned to one department but can teach courses
in other departments. They may also supervise research projects,
which include details like the project name, a unique code, a
description, and the funding allocated to the project.
• Students are uniquely identified by their student ID and have
personal information recorded, such as name, address, email,
gender, date of birth, and enrollment year. Students enroll in
multiple courses, and the database keeps track of the semester,
grade, and instructor for each course they take. Each student has
an assigned advisor, who is a professor from their department.
• The database also stores information about research projects
conducted by professors and students. Each project is identified by
a unique code, has a specific name and description, and is funded
by an external or internal source with a specified budget.
• To support scholarship programs, the database includes
records of students receiving scholarships. For each
dependent scholarship, the database stores details such
as the scholarship name, amount, type, and duration of
funding. Additionally, students may receive scholarships
from multiple funding sources.
• The system ensures that all relationships and
constraints are maintained, such as students enrolling
in courses across departments, professors teaching
multiple courses, and departments managing multiple
courses and projects. This structure allows for the
effective management and retrieval of university data.
Weak Entity Types
• A weak entity type normally has a partial key, which
is the attribute that can uniquely identify weak
entities. i.e., Name, Birthdate etc.
• Example:
• A DEPENDENT entity is identified by the dependent’s first name,
and the specific EMPLOYEE with whom the dependent is related
• Name of DEPENDENT is the partial key
• DEPENDENT is a weak entity type
• EMPLOYEE is its identifying entity type via the identifying
relationship type DEPENDENT_OF
Relationship Types
• In ER diagrams, relationship types are displayed as
diamond-shaped boxes which are connected by
straight lines to the rectangular boxes representing
the participating entity types.
• The relationship name is displayed in the
diamond-shaped box
Relationship Degree
• Degree of a Relationship Type: number of
participating entity types.
• i.e. WORKS_FOR relationship is of degree two (binary).
• Binary degree of relationship is most common.
• Recursive relationships or self-referencing
relationships: same entity type participates more
than once in a relationship type in different roles
Recursive Relationship Type is: SUPERVISION
(participation role names are shown)
Refining the initial design by introducing
relationships
Slide 3- 33
Relationships and Relationship Types (1)
Slide 3- 34
Relationship Types
• Relationship Type:
• Is the schema description of a relationship
• Identifies the relationship name and the participating entity types
• Also identifies certain relationship constraints.
• For example, the attribute Manager of DEPARTMENT refers to an employee
who manages the department;
• the attribute Controlling_department of PROJECT refers to the department
that controls the project;
• the attribute Supervisor of EMPLOYEE refers to another employee (the one
who supervises this employee);
• the attribute Department of EMPLOYEE refers to the department for which
the employee works; and so on.
• Relationship Set:
• The current set of relationship instances represented in the database
• The current state of a relationship type
Participation Constraints and
Existence Dependencies
• Participation constraint: specifies whether the
existence of an entity depends on its being related
to another entity via the relationship type.
• There are two types of participation constraints
• Total Participation/ Existence: Employee must work for
department otherwise the employee entity does not
exist.
• Partial Participation: department must have a single
manager to manage the department. Manager instances
comes from the employee instance set.
• Structural Constraints: cardinality ratio and
participation constraints.
Attributes of Relationship Types
• Relationship
types can
also have
attributes.
Attributes of Relationship Types
• Attributes of 1:1 or 1:N relationship types can be
migrated to one of the participating entity types.
• For a 1:N relationship type, a relationship attribute
can be migrated only to the entity type on the
N-side of the relationship.
• For M:N (many-to-many) relationship types,
• Some attributes may be determined by the combination
of participating entities, not by any single entity.
• Such attributes must be specified as relationship
attributes. An example is the Hours attribute of the M:N
relationship WORKS_ON
Attributes of Relationship Types
• The number of hours per week an employee
currently works on a project is determined by an
employee-project combination and not separately
by either entity.
Refining the ER Design for the COMPANY
Database
Alternative (min, max) notation
for relationship structural
constraints:
• Specified on each participation of an entity type E in a relationship type R
• Specifies that each entity e in E participates in at least min and at most max
relationship instances in R
• Default(no constraint): min=0, max=n (signifying no limit)
• Must have min≤max, min≥0, max ≥1
• Derived from the knowledge of mini-world constraints
• Examples:
• A department has exactly one manager and an employee can manage at
most one department.
• Specify (0,1) for participation of EMPLOYEE in MANAGES
• Specify (1,1) for participation of DEPARTMENT in MANAGES
• An employee can work for exactly one department but a department can
have any number of employees.
• Specify (1,1) for participation of EMPLOYEE in WORKS_FOR
• Specify (0,n) for participation of DEPARTMENT in WORKS_FOR
• The numbers mean that for each entity e in E, e
must participate in at least min and at most max
relationship instances in R at any point in time.
• In this method, min = 0 implies partial participation,
whereas min > 0 implies total participation.
The (min,max) notation for
relationship constraints
Rational (IBM) Rational Rose UML Modeling & application generation in C++/JAVA
Resolution Ltd. Xcase Conceptual modeling up to code maintenance
Sybase Enterprise Application Suite Data modeling, business logic modeling
Visio Visio Enterprise Data modeling, design/reengineering Visual Basic/C++
Slide 3- 52