Creating An ERD Using Microsoft VISIO
Creating An ERD Using Microsoft VISIO
In this exercise, you’ll use VISIO to create the ERD shown here.
Open VISIO. Select Software and Database from the list of template categores (shown on the
left). Select Database Model Diagram. (If you don’t see the option to select a drawing type,
select File from the menu bar then select New … Software and Database from the list of
templates. If you don’t every see Software and Database as a template option, you probably
don’t have the correct version of Visio installed. Use a computer in the BC lab.)
Page 1 of 6
Drag-n-drop an entity from the Shapes panel (on
the left) into the drawing grid (on the right).
Change the generic name initially provided by
typing “Patient” for the Physical name and
Conceptual Name in the Database Properties
panel (lower right).
Page 2 of 6
Enter the columns names shown here.
Modify the Patient_ID column data type as shown below. Reduce the “precision” of the field
which give the total number of digits the field can have. Set the scale to zero, which means
only integers will be stored. (The scale value determines how many digits to the right of the
decimal place are allowed.)
Also, make the patient name fields required (see above) and make Patient_ID the primary key
(PK).
Create a second entity called Appointment and create the columns as shown below. Designate
all the columns as required and mark Appt_ID as the primary key.
Page 3 of 6
Create a relationship between the PATIENT and APPOINTMENT entities. What is this
relationship?
Any one patient (Bill Jones, for example) may have no appointments but may have many.
Any one appointment (#2191 at 4 p.m. on 5/21) must be for one patient and no more than
one.
These statements show that there is a one-to-many relationship between PATIENT and
APPOINTMENT. In VISIO the terminology for this relationship describes PATIENT as the
“parent” table and APPOINTMENT as the “child” table. Creating an appointment record is
dependent on being associated with a valid patient ID in the PATIENT table.
Page 4 of 6
Check the settings shown below and click OK.
Now, the diagram should look like the example shown below—minimum and maximum
cardinality are shown. The relationship shown matches the description of the relationship
given earlier except the minimum number of patients that can be related to an appointment is
one (i.e., you can have an appointment without specifying which patient the appointment is
for).
To change the modality, click the relationship between the two entities. Select Miscellaneous
in the Database Properties panel. Under Relationship type switch to Identifying then switch
back to Non-identifying. Now, the minimum number of patients related to an appointment
should be 1 instead of zero as shown below.
Page 5 of 6
Create another entity call MEDICAL HISTORY.
This time, however, uncheck Sync Names and
make the physical name different from the
conceptual name, as shown below.
Create the columns shown here. Edit the data types as shown, too. Don’t create a primary key
yet.
Create a relationship between PATIENT and MEDICAL HISTORY, with PATIENT has the “parent.”
Modify the relationship settings as shown below. The relatinoship between PATIENT and
MEDICAL HISTORY is one-to-one and Patient_ID serves as the primary key and foreign key in
MEDICAL HISTORY.
Page 6 of 6