48 CHAPTER 3 ■ Entity-Relationship ModelingCUSTOMERc1c2c3c4c5Placesr1r2r3r4r5r6r7ORDERo1o2o3o4o5o6o7(d)GradeSTUDENTRegistersCOURSE(e)STUDENTRegistersr1COURSEs1s2s3s4s5s6r2r3r4r5r6r7a1a2a3a4r8(f)Figure 3.15 (continued)
SECTION 3.10 ■ Ternary Relationships 49since each department must be managed by an employee, but not all employees manage departments.For example, while some of the employees in Figure 3.15(b), such as e2, e4, and e6,do not manage a department, every department is managed by an employee.The binary one-to-many relationship represented in Figure 3.15(c) features a slightly differentarrangement. While a customer can place several orders or may choose not to order at all,each order must be placed by exactly one customer. Figure 3.15(d) shows us that, while eachorder is made by a single customer, not all customers place orders. However, Figure 3.15(d) differsfrom Figure 3.15(b) in that a single customer may place any number of orders; while the firstcustomer places three orders, and the fifth customer places only two, both transactions representa maximum cardinality of many.Finally, Figure 3.15(e) and (f) illustrates a many-to-many relationship, featuring a minimumcardinality of zero and a maximum cardinality of many. In other words, each student canparticipate in many activities, a single activity, or no activity at all. Conversely, any number ofstudents, from many to none, can participate in a given activity.3.10 Ternary RelationshipsRecall that a ternary relationship R is a relationship among instances of three different entitytypes, E 1 , E 2 , and E 3 (R ∈ E 1 × E 2 × E 3 ). Each instance of the ternary relationship R requires the participationof an instance from each of the entity types E 1 , E 2 , and E 3 . See Figure 3.16 for examplesof ternary relationships.The examples in Figure 3.16(a) and (b) reveal the possible relationships associated with acompetition for classical musicians. Let’s suppose that at this competition, musicians performindividually and in small groups for judges who rate the performances. Each performance requiresan artist, a composition, and a venue. Observe that each relationship instance, Performs,connects an entity instance of MUSICIAN, COMPOSITION, and VENUE. Each relationship instancealso has an attribute, Rating, that stores the average rating of the performance by a panelof judges. Similarly, in Figure 3.16(c), students use equipment to work on projects; each instanceof Uses involves an instance of STUDENT, PROJECT, and EQUIPMENT. If a student uses twopieces of equipment to work on a project, there are two instances of the relationship Uses. Acampus lab may use the attribute in this ternary relationship, the Date of use, to log the equipmentusage.Ternary relationships differ significantly from the other kinds of relationships that we haveexamined so far. It is important to remember that a ternary relationship is not equivalent totwo binary relationships. Suppose that we recognize this ternary relationship as a series of binaryrelationships, such as ARTIST-CONCERT, ARTIST-COMPOSITION, and CONCERT-COMPOSITION. These three binary relationships can store data about the artists whoperformed at different concerts, the compositions performed by artists, and the compositionsperformed at different concerts; however, the relationships cannot store the compositions performedby an artist at a particular concert. Therefore, three binary relationships cannot encapsulatethe range of data stored by a single ternary relationship. A ternary relationship, though,can capture the data of three binary relationships.Observe that the cardinalities of the relationships in Figure 3.16 are not expressed in theE-R diagrams. The cardinalities of a relationship are defined for a pair of entities; in a ternary relationship,there are three pairs of ternary relationships. We cannot express the cardinalities ofthese types of relationships in E-R diagrams. Instead, we can turn the ternary relationship intoan associative entity, a process that we will discuss in Section 3.12. This technique allows us todemonstrate the cardinalities of the entities within the associative entity.