APPENDIX A Data Modeling - Sdu
APPENDIX A Data Modeling - Sdu
APPENDIX A Data Modeling - Sdu
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
6 Appendix A <strong>Data</strong> <strong>Modeling</strong><br />
Entity<br />
Example Instances<br />
FIGURE A-3<br />
Entities and Instances<br />
Patient<br />
John Smith<br />
Susan Jones<br />
Peter Todd<br />
Dale Turner<br />
Pat Turner<br />
Concatenated<br />
Identifier<br />
Single Identifier<br />
Identifier to be Added<br />
Later<br />
PATIENT PATIENT PATIENT<br />
FIGURE A-4<br />
Choices for Identifiers<br />
PAT_lastname<br />
PAT_firstname<br />
PAT_Idnumber<br />
PAT_lastname<br />
PAT_firstname<br />
PAT_lastname<br />
PAT_firstname<br />
appointment” and “an appointment is scheduled by a patient.” In Figure 7.1, we have<br />
included words for both directions of the relationship line; the top words are read from<br />
parent to child, and the bottom words are read from child to parent. Notice that the doctor<br />
entity is the parent entity in the doctor – appointment relationship.<br />
Cardinality Relationships have two properties. First, a relationship has cardinality, which<br />
is ratio of parent instances to child instances. To determine the cardinality for a relationship,<br />
we ask ourselves: “How many instances of one entity are associated with an instance<br />
of the other?” (Remember that an instance is one occurrence of an entity, such as patient<br />
John Smith, Dr. Dave Brousseau, or Aetna Insurance Company.) For example, how many<br />
appointments can a patient schedule? How many patients are associated with an appointment?<br />
How many insurance companies can a patient have? The cardinality for binary relationships<br />
(i.e., relationships between two entities) are 1 : 1, 1 : N, or M : N, and we will<br />
discuss each in turn.<br />
The 1 : 1 relationship (read as “one to one”), means that one instance of the parent<br />
entity is associated with one instance of the child entity. Notice that there is a 1 : 1 relationship<br />
between appointment and bill in Figure A-1. Each appointment (the parent<br />
entity) always results in a single bill that is generated, and a bill (the child entity) is associated<br />
with only one appointment. The model contains a solid dot and a number “1” on the<br />
relationship line nearest the child entity to designate the 1 : 1 relationship.<br />
More often, relationships are 1 : N relationships (read as “one to many”). In this kind<br />
of relationship, a single instance in a parent entity is associated with many instances of a<br />
child entity; however, the child-entity instance is only related to one instance in the parent.<br />
For example, a patient (parent entity) can schedule many appointments (child<br />
entity), but a particular appointment is scheduled by only one patient, suggesting a 1 : N<br />
relationship between patient and appointment. Another 1 : N relationship is between<br />
insurance company and payment (an insurance company can make many payments, but a<br />
specific payment is only associated with one insurance company). A character resembling<br />
a solid dot is placed closest to appointment to show the “many” end of the relationship.