DATABASE MANAGEMENT SYSTEM
  • RELATIONSHIP AND RELATIONSHIP SET
  • Relationship:
    • A relationship is an association between two or more entities. It describes how entities are connected or interact with each other.
  • Relationship Set:
    • A relationship set is a collection of similar relationships. If there is a relationship between entities A and B, the set of all such relationships forms a relationship set. For example, if "Works_For" is a relationship between "Employee" and "Department" entities, the set of all "Works_For" relationships is the "Works_For" relationship set.
  • Degree of a Relationship:
    • The degree of a relationship refers to the number of entities participating in the relationship. Relationships can be binary (involving two entities), ternary (involving three entities), and so on.
  • Cardinality of a Relationship:
    • Cardinality describes the number of instances of one entity that can be related to a single instance of another entity. Cardinality is expressed as a ratio, such as one-to-one (1:1), one-to-many (1:N), or many-to-many (M:N).
  • Role of an Entity in a Relationship:
    • In a relationship, each participating entity may play a specific role. For example, in a "Teaches" relationship between "Teacher" and "Course," the teacher may play the role of "Instructor," and the course may play the role of "Subject."

 

Example:

  • Consider entities "Student" and "Course" with a relationship "Enrolls_In."
  • The relationship set "Enrolls_In" captures instances of students enrolling in courses.
  • The cardinality might be one-to-many, indicating that each student can enroll in multiple courses, but each course is typically associated with multiple students.

Participation in DBMS

 

  • Total Participation:(======) Every single entity in a set MUST be involved in at least one relationship within that set. Example, an employee can't exist unless they work in a department .

  • Partial Participation:(---------) Some entities in a set CAN exist without being involved in a relationship within that set.Example ,a course can exist within an organization even if no students are currently enrolled.

Strong entity can either have no participation or total participation. Weak entity always have total participation. The relationship between two strong entities is represented by a single diamond. The relationship between a weak entity and a strong entity is represented by a double diamond.