7. ENTITY RELATIONSHIP MODELLING

7.2.1: Weak Entities

Sometimes we know certain entities only exist in relationship to others. For example, a typical educational institution comprises a number of departments that offer courses. So, we could have a History department, an Art department and so on. These departments would design and deliver courses that students would register for. In this framework the courses exist in the context of a department, and the identifier for a course is typically a department code and course number combination. So, the history course, Introduction to History, belongs to the History department and it could be known by the identifier HIST- 765. HIST is a code representing the History department and 765 is a number assigned to the course; other departments could have a course with that same number, 765.

In these situations where the existence of an entity depends on the existence of another entity, we say the entity is a weak entity, and the corresponding entity type is a weak entity type. Weak entities often have identifiers that comprise multiple parts (such as department code and course number). Later we will see other aspects of an ERD that relate to weak entity types. At this time, we should be aware that weak entity types are illustrated in an ERD with a double-lined rectangle:

image
                       Figure 7.6: Course as a weak entity type

Often when we purchase things the vendor provides an invoice giving details of each item that is purchased (see the sample invoice below). Appearing on the invoice are detail lines specifying the product, the quantity and price. Invoice lines are things that exist only in

the context of an invoice and so each invoice line is a weak entity; the invoice lines are existence-dependent on an invoice:

 

image
                                         Figure 7.7: Sample Invoice

The following includes a few attributes to show how Invoice and Invoice Line could appear in an ERD:

image
         Figure 7.8: Invoices (regular entity type) and Invoice Lines (weak entity type)

Exercises

1) Consider a requirement having to do with benefits that may be given to employees of a company. Suppose employees work in a department and that each employee may have several dependents (spouse, child). Draw an ERD that includes Department, Employee, and Dependent in your design. Include attributes for your entity types.

 

2) When you buy items in a store you often get a cash register receipt that details the items you have purchased. Develop an ERD that includes Store, Customer, Receipt, and Detail Lines.

License

Share This Book