0% found this document useful (0 votes)
81 views37 pages

Database Processing:: Online Appendix F

This document provides an overview of how to use Microsoft Visio 2010 to create data models and database designs. It explains that Visio has templates for these diagrams that contain shapes for entities, relationships, and other elements. The document guides the user through opening the Database Model Diagram template, which creates a new drawing with the necessary shape stencils. It describes the key shapes for entities, relationships, and other elements needed to construct data models and database designs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views37 pages

Database Processing:: Online Appendix F

This document provides an overview of how to use Microsoft Visio 2010 to create data models and database designs. It explains that Visio has templates for these diagrams that contain shapes for entities, relationships, and other elements. The document guides the user through opening the Database Model Diagram template, which creates a new drawing with the necessary shape stencils. It describes the key shapes for entities, relationships, and other elements needed to construct data models and database designs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Database Processing:

Fundamentals, Design, and Implementation


12th Edition

David M. Kroenke David J. Auer

Online Appendix F
Getting Started with
Microsoft Visio 2010
Database Processing Appendix F

Appendix F 10 9 8 7 6 5 4 3 2 1

F-2
Database Processing Appendix F

Objectives:

To learn how to create data models in Microsoft Visio 2010


To learn how to create database designs in Microsoft Visio 2010
To understand that Microsoft Visio 2010 has a template for creating process diagrams using
Business Process Modeling Notation (BPMN)

What is the Purpose of this Appendix?


Microsoft Visio 2010 is a component of Microsoft Office 2010, and is widely used to produce a variety of
diagrams. There are three versions of Microsoft Visio 2010: Standard, Professional, and Premium. You
can see a comparison chart for these versions at http://office.microsoft.com/en-us/visio/visio-edition-
comparison-FX101838162.aspx . The templates that we used in this appendix are available in both the
Professional and Premium editions.1

In this appendix, we are primarily interested in Microsoft Visios ability to create data models and
database designs. We will also take a brief look at Microsoft Visios ability to create process diagrams
using Business Process Modeling Notation (BPMN).

Why Should I Learn to Use Microsoft Visio 2010?


For the purposes of this book, the most important reason to learn to use Microsoft Visio is that it
provides a convenient method of creating the data models discussed in Chapter 5 and the database
designs discussed in Chapter 6. Unfortunately, Microsoft Visio data models do not provide true linking

1
Students registered in CS or MIS classes should check to see if your school is part of the Microsoft Developers
Network Academic Alliance (MSDNAA) program (http://msdn.microsoft.com/en-us/academic/default.aspx). If so,
you may be able to obtain Microsoft Visio 2010 Professional through that program.

F-3
Database Processing Appendix F

between entities (as programs such as ERWin and Visible Analyst do), and Microsoft Visio database
designs use a unique notation system rather than the IE Crows Foot notation used in this text (and by
the MySQL Workbench as described in Appendix E). None the less, if you have Microsoft Visio 2010
Professional, you will have a tool capable of producing the data models and database designs required
in the solutions to Review Questions and Project Questions in Chapters 5 and 6.

What Will This Appendix Teach Me?


As its title implies, this appendix is designed to get you started using Microsoft Visio 2010 to create data
models and database designs so that you have a tool to create these diagrams.

What Wont This Appendix Teach Me?


The material in this appendix does not go beyond what is necessary to get you started using Microsoft Visio
2010 on the topics covered in Database Processing: Fundamental, Design,and Implementation (12th Edition)
[hereinafter referred to as DBP]. There are many important Microsoft Visio topics not covered here, including
organization charts, project management diagrams (such as Gantt charts and Pert charts), network diagrams
(such as Active Directory tree), and Web site maps.

How Do I Start Microsoft Visio 2010?


To start Microsoft Visio 2010 running in Microsoft Windows 7, select Start | All Programs | Microsoft
Office | Microsoft Visio 2010. The Microsoft Visio 2010 splash screen is displayed, followed by the
Microsoft Visio 2010 window with the Home page displayed, as shown in Figure F-1.
Microsoft Visio 2010 uses the Microsoft Office Fluent user interface found in most (but not all) Microsoft
Office 2007 and Office 2010 products. For more information on this interface, see Appendix A, pages A-8
A-10. Here we note that Microsoft Visio 2010 opens with the New tab and associated page of the
Backstage view displayed (the Backstage view is displayed when the File command tab is selected).

How Do I Create a Database Model Diagram in Microsoft Visio 2010?


To open a template for data models and database design, click the Software and Databases button to
display the available software and database templates, as shown in Figure F-2. Click the Database
Model Diagram template to select it, as shown in Figure F-3. The Database Model Diagram template is
the one that Microsoft Visio 2010 uses for data models and database designs. Note that the name
Database Model Diagram conflates these two diagrams as we understand them from our discussion in
Chapters 4 and 5. None the less, this is the template we want, and we will have to sort things out as we
go along. Also note that in the information about the Database Model Diagram shown in Figure F-3,
Microsoft states that this template is used for IDEF1X and relational diagrams. We briefly mentioned
IDEF1X notation in Chapter 5 (and it is covered in more detail in Appendix C), but in this appendix, as we
do in the book itself, we are using IE Crows Foot notation. Again, we will just have to sort things out as
we go along. Click the Create button to create a new Database Model Diagram document, as displayed
in Figure F-4.

F-4
Database Processing Appendix F

The File command


tab

The Backstage
view

The New tab and


associated page
showing available
templates for a new
diagram document

Click to see Soft-


ware and Data-
base templates

Figure F-1 The Microsoft Visio 2010 Backstage View New Tab

The Software and


Database tem-
plates

Click to select the


Database Model
Diagram templates

Figure F-2 The Software and Database Templates

F-5
Database Processing Appendix F

The Database
Model Diagram
template is select-
ed

Information about
the Database
Model Diagram
template

Click Create to
create a new Mi-
crosoft Visio 2010
document

Figure F-3 The Database Model Diagram Template

As shown in Figure F-4, a new, blank diagram document, named Drawing1, is created, the appropriate
Shapes stencils ( a stencil is Microsoft Visio 2010s term for a group of template objects) are displayed in
the Shapes window, and database properties are displayed in the Database Properties window. Figure F-
5 shows more detail of the Shapes window, including:

The Minimize the Shapes window button As the name says, use this to minimize the Shapes
window.
The More Shapes button Use this to display the More Shapes list, as shown in Figure F-5, if
you need to add additional shape templates to the drawing.
The Entity Relationship (US units) button Use this to display the Entity Relationship (US units)
shapes pane.
The Entity Relationship (US units) stencil The set of shape objects in the Entity Relations (US
units) stencil.

The Entity Relationship (US units) stencil contains all the template objects we will use to build our data
models and database designs. As shown in Figure F-6, it contains:

The Entity object Use this object to create entities (data model) and tables (database design)
in the Microsoft Visio database model diagram.
The Relationship object Use this object to create relationships between tables in database
designs.

F-6
Database Processing Appendix F

The Drawing1
document name

The Shapes win-


dows

The Drawing1
document

The Database
Properties window

Figure F-4 The Microsoft Visio 2010 Database Model Diagram

The Minimize the


Shapes window
button

The More Shapes


button

The More Shapes


list

The Entity Rela-


tionship (US
units) button

The Entity Rela-


tionship (US
units) shapes
stencil

Figure F-5 The Shapes Window

F-7
Database Processing Appendix F

The Entity object The Relationship


object
The View object

The Parent to cat-


egory connector
The Category ob- object
ject
The Category to
The Dynamic child connector
connector object object

Figure F-6 The Entity Relationship (US units) Stencil Objects

The Dynamic connector object Use this object to create relationships between entities in
data models.
The View object Use this object to create SQL views (discussed in Chapter 7) in data models
and database designs.
The Category object Use this object to create supertype/subtype relationships in data models
and database designs.
The Parent to category connector object Use this object to create supertype/subtype
relationships in database designs.
The Category to child connector object Use this object to create supertype/subtype
relationships in database designs.

Figure F-7 shows the Microsoft Visio 2010 window with:

The Shapes windows minimized Note that all of the Entity Relationship (US units) stencil
objects are still visible.
The Expand the Shapes window button Use this to restore the Shapes window to its full size.
The Quick Access Toolbar with add Quick Print and Print Preview buttons The Quick Access
Toolbar, and how to control which buttons are displayed on it, is discussed in Appendix A.
The Zoom controls Use these to control the displayed size of the drawing, now shown at
104%.

By configuring the Microsoft Visio 2010 window in this manner, we have a much more efficient working
area.

F-8
Database Processing Appendix F

The Quick Access


Toolbar

The Save button

The Expand the


Shapes window
button

The minimized
Shapes window

The Drawing1
document at 104%

The Zoom controls

Figure F-7 The Microsoft Visio 2010 Database Model Diagram with Minimized Shapes Window

How Do I Name and Save a Database Model Diagram in Microsoft Visio 2010?
We will illustrate creating data models and database designs in Microsoft Visio 2010 by creating an E-R
diagram for the Wedgewood Pacific Corporation (WPC) database that we created in Microsoft Access in
the Project Question in Chapters 1 and 2, and will create in SQL Server 2008 R2 in Chapter 7.2 The
column characteristics for each of the the WPC tables are shown in Figure F-8.

To save a Microsoft Visio 2010 database model diagram drawing, click the Save button in the Quick
Access Toolbar. The first time we save the drawing, Microsoft Visio 2010 opens a Save As dialog box.
This is a standard Microsoft Office 2010 dialog box. Name the drawing as WPC-Database-Model-Tables.

2
Of course, it could be agrued that we really should have created the database design first, and then implemented
that design. In many database courses, the data modeling and database design topics (which we cover in Chapter 5
and 6) are taught before using SQL to create the databases (which we cover in Chapter 7). In this case, the
database design will proceed the actual implementation of the database in the DBMS. We prefer to introduce SQL
queries earlier. There are two reasons for this. First, users who are never involved in creating databases still often
use SQL or QBE for querying databases (usually data warehouses or datamarts as discussed in Chapter 13) to
gather informatin. Second, we like to get our students involved with DBMSs, databases and SQL as early in the
course as possible. Either approach works, and your Professor will choose the one that he or she likes best.

F-9
Database Processing Appendix F

Figure F-8 The WPC Database Table Column Characteristics

F-10
Database Processing Appendix F

The basic entities/tables that we will need to create a data model and a database design in Microsoft
Visio 2010 are the same. We will create them in the WPC-Database-Model-Tables document, and then
use copies of this document as the basis for creating a separate data model and database design.

As we discuss in Chapters 5 and 6, one of the main differences between a data model and a database
design is how N:M relationships are handled. In a data model, N:M relationships exist as N:M non-
identifying relationships between two strong entities. In a database design, N:M relationships are
broken into two 1:N identifying relationships between three ID-dependent entities. So, we will build the
entities/tables we need, and then consider exactly how Microsoft Visio 2010 handles data models and
database design.

Also as we discuss in Chapters 5 and 6, the diagrams we are creating are entity-relationship models, and
we are using the IE Crows Foot notation as our standard. We will also see how well Microsoft Visio 2010
supports IE Crows Foot notation.

How Do I Create Entities/Tables in a Database Model Diagram in Microsoft Visio


2010?
Now that we have a blank document to use as an E-R diagram work area available, we can build the E-R
diagram itself. We start by adding an entity (data model term) or table (database design term) to the E-R
diagram. For simplicity, we will use the term table in this discussion, since this is consistent with SQL
statement usage. We will add the DEPARTMENT table. By looking at the column characteristics of the
DEPARTMENT table in Figure F-8, we can see the columns that are used in the DEPARTMENT table.

Creating a Table in the Microsoft Visio E-R Diagram:

1. In the Shapes window, click-and-hold the Entity object shown in Figure F-6.
2. Move the cursor over the blank E-R diagram area, and then release the left mouse button. A
new table object named Table1 is created on the E-R Diagram, as shown in Figure F-9. Note that
the Database Properties window now displays the properties of the Table1 object.
NOTE: Although Microsoft Visio 2010 has an entity shape in the stencil, it is a table object that is
placed in the E-R diagram! This is somewhat inconsistent, dont you think?
3. In the Database Properties window, click the Physical name text box to select it, and type in the
table name DEPARTMENT. Note that the new table name immediately appears in the
Conceptual name text box (if the Database Properties Sync names when typing checkbox is
checked) and the table object in the E-R diagram area, as shown in Figure F-10.

F-11
Database Processing Appendix F

The named WPC-


Database-Model-
Tables.vsd dia-
gram document

The Table1 table


object

Physical (database
design) and con-
ceptual (data mod-
el) names are
synced

The Definiton cat-


egory page of Da-
tabase Properties

Type the table


physical name DE-
PARTMENT in this
text box

Figure F-9 The Table1 Table Object

The renamed table


object

The table physical


name DEPART-
MENT was typed in
this text box

The synced table


conceptual name

The Columns cat-


egory

Figure F-10 The Database Properties Definition Window

F-12
Database Processing Appendix F

Creating the DEPARTMENT Table Columns in the Visio E-R Diagram:

1. In the Database Properties window, click the Columns category. The DEPARTMENT Columns
page is displayed, as shown in Figure F-11.
2. The primary key column name for DEPARTMENT (as shown in the column characteristics Key
listings in Figure F-8) is DepartmentName. Click the Physical Name text box of the first row in the
Columns category, and type the column name DepartmentName. The diagram now appears as
shown in Figure F-12, with a suggested Data Type and Notes inserted.

Note that where Microsoft Access uses a data type called Text, most other DBMS products use a data
type called Char (for character). Microsoft Visio also uses the Char data type instead of Text. Also note
that there is a Data Type drop-down list arrow in the Data Type field to display the Data Type drop-down
list as shown in Figure F-12. We can select the correct data type from this list if necessary and then edit
the selected data type as necessary (alternatively, you can just type the correct data type into the Data
Type field.) Also note that Data Types can be either Portable data types or Physical data types
(Microsoft Access). Unless you have a specific reason for doing so, use the default physical data types.3

3. The Data Type for DepartmentName is currently CHAR(10), but it should be CHAR(35). Edit the
Data Type to read CHAR(35).
4. Check the Reqd (Required = NOT NULL) check box.

Type the DEPARTMENT


primary key column name
DepartmentName in this
text box

Figure F-11 Adding the Primary Key Column

3
The default Physical data type is for Microsoft Access. This can be changed by clicking the Database command
tab, then clicking the Database Drivers button, and then selecting the preferred database from the list provided.

F-13
Database Processing Appendix F

The Data Type


drop-down list
type in the data
type or select it
from this list (and
edit parameters)

Blank new column


row

The Columns tab

Figure F-12 The Data Type Drop-Down List

The completed
DepartmentName
primary key column

Blank new column


row

Figure F-13 The Completed DepartmentName Primary Key Column

5. Check the PK (Primary Key) check box. Note how the Notes field changes to reflect the primary
key designation. There are no other settings that need to be changed for the DepartmentName
column.
6. Click the Column Name field in the blank row immediately below DepartmentName. The
completed DepartmentName column row, and a new blank column row is displayed as shown in
Figure F-13. Note that the correct column settings are now displayed in the DEPARMENT table
object in the E-R diagram.

F-14
Database Processing Appendix F

7. Add the other columns to the DEPARTMENT table. This is a straightforward procedure at this
point. The complete DEPARTMENT table is shown in Figure F-14.
8. Click the Save button on the Quick Access Toolbar to save the changes to the diagram.

Now we will build the EMPLOYEE and PROJECT tables, but we will wait to build the ASSIGNMENT table
until we discuss how to create relationships. The process is similar to the process we used to build the
DEPARTMENT table, and the results are shown in Figure F-15. Note that the table objects have been
resized and rearranged.

The DEPARTMENT table

Figure F-14 The Completed DEPARTMENT Table

The DEPARTMENT table

The EMPLOYEE table

The Dynamic Connector


stencil object

The PROJECT table

Figure F-15 The Completed DEPARTMENT, EMPLOYEE and PROJECT Tables

F-15
Database Processing Appendix F

How Do I Create Relationships Between Tables in a Database Model Diagram in


Microsoft Visio 2010?
Now that we have created the tables, we need to connect them with relationships. At this point, we will
explore two options for creating relaionships in Microsoft Visio 2010:

The Dynamic connectorUsed between two entities, this is just a line, and has no primary key /
foreign key dataused for data models.
The Relationship connectorUsed between two tables, and incorporates primary key / foreign
key dataused for database designs.

The type of relationship displayed and other relationship parameters is controlled by the connector
properties. That is how we know if we have, for example, a 1:1 non-identifying, 1:N non-identifying, or
1:N identifying relationship.

Microsoft Visio 2010 uses the term non-identifying relationship, whereas in DBP
we use the term nonidentifying relationship. We have seen the term non
identifying relationship used in other contexts. All three terms mean exactly the same thing, and which
is used is a matter of style. Since Microsoft Visio 2010 uses non-identifying, we will also use that term in
this appendix for consistency with the Microsoft Visio 2010 screen shots, while remaining well aware
that we have used nonidentfying in DBP itself.

It is also how we handle N:M relationships. In a data model, N:M relationships exist as N:M non-
identifying relationships between two strong entities. In a database design, N:M relationships are
broken into two 1:N identifying relationships between three ID-dependent entities.

Now we will build a data model and a database design to consider exactly how Microsoft Visio 2010
handles these diagrams. However, to do this we need to create two copies of our current file.

Creating Copies of the WPC-Database-Model-Tables.vsd File:

1. Click the File command tab to display the Backstage view.


2. Click the Save As.. command. The Save As dialog box is displayed.
3. In the File name text box of the Save As dialog box, type the file name WPC-Database-
Design.vsd.
4. Click the Save button.
5. Click the File command tab to display the Backstage view.
6. Click the Save As.. command. The Save As dialog box is displayed.
7. In the File name text box of the Save As dialog box, type the file name WPC-Data-Model.vsd.
8. Click the Save button.

We now have three copies of our file:

F-16
Database Processing Appendix F

The orginal WPC-Database-Model-Tables.vsd fileThis file is our basic working file with only
the tables in it, and it is now closed.
The WPC-Database-Design.vsd fileThis file will be used for our WPC database design, and it is
now closed.
The WPC-Data-Model.vsd fileThis file will be used for our WPC data model, and it is currently
open and ready for use.

How Do I Create Data Models Using Dynamic Connectors in Microsoft Visio 2010?
At this point, we need to create two 1:N non-identifying relationships, one between DEPARTMENT and
EMPLOYEE and one between DEPARTMENT and PROJECT. We will start with the relationship between
DEPARTMENT and EMPLOYEE

Creating a 1:N Nonidentifying Relationship Between Two Tables:


1. Click-and-hold the Dynamic Connector object.
2. Drag the object into the E-R diagram, and move it towards the center of the EMPLOYEE table.
When the EMPLOYEE table is outlined in red, the connector is attached to the table object
release the mouse button. The E-R diagram now appears as shown in Figure F-16.
3. Drag the dynamic connector object in the E-R diagram, and drag the free end of it towards the
center of the DEPARTMENT table. When the DEPARTMENT table is outlined in red, the
connector is attached to the table objectrelease the mouse button. The E-R diagram now
appears as shown in Figure F-17.
4. The term Dynamic Connector means that if we move any of the objects to which the connector
is attached, then the connector will automatically adjust its size and position to match. In Figure
F-18, we have moved the DEPARTMENT table towards the center of the E-R diagram, and the
connector has adjusted itself as needed.
5. Click anywhere in the E-R diagram to de-select the dynamic connector object. Note that when
not selected, the object appears as a line, as shown in Figure F-19.
6. We can format the line properties of the dynamic connector. Click the connector to select it, and
then right-click to display the short-cut menu as shown in Figure F-20.
7. In the short-cut menu, click the Format command to display the Format menu. In the Format
menu, click the Line command to display the Line dialog box, as shown in Figure F-21.

The Line dialog box is important, because it allows us to:

Format the line itself in terms of style (solid, dashed), weight (thickness) and color.
Format each end of the line with a symbol (arrowhead, IE Crows Foot symbol *E-R diagrams],
IDEF1X symbol [E-R diagrams], and UML [E-R diagrams]).

F-17
Database Processing Appendix F

Click-and-hold Dy-
namic Connector
object, then drag it
onto the E-R dia-
grammove it to
the center of the
EMPLOYEE table,
and when the table
is outlined in red
release the mouse
button

The connected Dy-


namic Connector
object

Figure F-16 The Dynamic Connector Attached to the EMPLOYEE Table

This allows us to format the relationship lines between the entities using the appropriate symbols for
the style of E-R diagram we are creating. In this appendix, we are creating IE Crows Foot E-R
diagrams,but note that symbols are included for IDEF1X and UML style E-R diagrams.4 The full set of
available line endsfor the begin end (the endend uses the same set but reversed)is shown in
Figure F-22.

Note that line ends 25, 28, 29 and 30 give us exactly the set of line ends we need to match those for IE
Crows Foot notation in Figure 5-8. We can use these to create IE Crows Foot data models. At this point,
you need to simply experiment with how to format the connector lines in Microsoft Visio 2010there
are too many possible details to put them all into this appendix.

8. The relationship between EMPLOYEE and DEPARTMENT is a 1:N non-identifying relationship (dashed
line) between the DEPARTMENT entity (parentthe 1 side of the relationshipuse line end 25) and
the EMPLOYEE entity (childthe N side of the relationshipuse line end 28). Format the connector
line to show this relationship, as shown in Figure F-23. Note that the diagram used line dash type 02,
weight 1.5 pts, color black, line ends 28 and 25, both medium size.
9. Click the Save button on the Quick Access Toolbar to save the work on the data model.

The relationship between DEPARTMENT and PROJECT is also a 1:N non-identifying relationship, and can
be created exactly the same way. You should create that relationship now, and save the data model
work again.

4
For details on IDEF1X and UML symbology in E-R diagrams, see Appendix C and Appendix D respectively.

F-18
Database Processing Appendix F

Click-and-hold the
free end of the Dy-
namic Connector
object, then drag it
to the center of the
DEPARTMENT
table, and when the
table is outlined in
red release the
mouse button

The connected Dy-


namic Connector
object

Figure F-17 The Dynamic Connector Attached to Both the EMPLOYEE and DEPARTMENT Tables

The DEPART-
MENT table has
been moved toward
the center of the
diagram, and the
dynamic connector
has adjusted

The connected Dy-


namic Connector
object

Figure F-18 The Dynamic Connector Adjusts as DEPARTMENT Table is Moved

The important question for a data model design tool is whether or not we can model an N:M non-
identifying relationship between two entities. As discussed in Chapters 5 and 6, an N:M relationship only
exists in a data model (as a non-identifying relationship between two strong enties). In a database
design, the N:M relationship becomes two 1:N ID-dependent identifying relationships linking the two
original tables through a new, third table called an intersection table.

F-19
Database Processing Appendix F

The DEPART-
MENT table has
been moved toward
the center of the
diagram, and the
dynamic connector
has adjusted

The connected Dy-


namic Connector
object

Figure F-19 The Dynamic Connector As a Line

Right-click the
connector to dis-
play the short-cut
menu

The short-cut
menu

Click the Format


command to dis-
play the Format
menu

The Format menu

The Line command

Figure F-20 The Short-Cut Menu

Using Microsoft Visio 2010 dynamic connectors, we can, in fact, model N:M relationships. At this point,
based on the WPC database in Figure F-8, we still need to build the ASSIGNMENT table and its
relationships with EMPLOYEE and PROJECT. However, for our WPC data model, lets assume that we
simply want an N:M relationship between EMPLOYEE and PROJECT. That is, employees will work on
projects, and projects must have employees to work on them. Figure F-24 shows the N:M relationship,
using the same dynamic connector construction (but with line end 25 on both ends of the line).

F-20
Database Processing Appendix F

The Line dialog Arrows (Line


box ends) properties

Line properties Begin symbol


(Line end)
Line type (Dash
type) End symbol (Line
end)
Line Weight
Begin symbol
(Line end) size

End symbol (Line


Line Color end) size

Figure F-21 The Line Dialog Box

Figure F-22 Available Line Ends Begin End

The Dynamic Con-


nector line format-
ted as described in
the appendix text

Figure F-23 The Formatted Dynamic Connector Line

F-21
Database Processing Appendix F

The Relationship
connector object
(for the next section
in the appendix)

The N:M relation-


ship as a Dynamic
Connector line for-
matted as de-
scribed in the ap-
pendix text

Figure F-24 The N:M Relationship in the Data Model

At this point, you should create the N:M relationship, and then save the data model. We will leave
adding the ASSIGNMENT table to the data model for the Exercises at the end of this Appendix.

In this model, the non-identifying relationships are correct (all three entities are strong entities), but
what about the minimum cardinalities? All relationships are shown as having mandatory minimum
cardinalities.

Does a DEPARTMENT have to have at least one employee? This is actually a business rule question, but
we will assume that the answer for WPC is yes, and that WPC does not allow departments without
employees to exist.

Does an EMPLOYEE have to be assigned to a department? Again, this is a business rule question, but the
fact that EMPLOYEE.Department is NOT NULL with a DEFAULT value of Human Resources is a good
indication that the answer for WPC is yes, and that WPC does not allow employees unassigned to
departments to exist.

We will also assume that every project has to have at least one employee assigned to it, and that every
empoyee has to work on at least one project. Therefore, the minimum cardinalities for the N:M
relationship are correct as created, and our relationship is correct as drawn. Note that if optional
minimum cardinalites are allowed, we just need to change which line end we use!

We have demonstrated how to build a data model using dynamic connectors. Next we will look at
building a database design using relationship connector objects.

Save the WPC-Data-Model.vsd file a final time, and then click File | Close to close the drawing.

F-22
Database Processing Appendix F

How Do I Create Database Designs Using Relationship Connectors in Microsoft Visio 2010?
We need to reopen our WPC-Database-Design.vsd file, which contains just the three tables we built:
EMPLOYEE, DEPARTMENT, and PROJECT. To open it in Microsoft Visio 2010, click File I Recent, and then
click the WPC-Database-Design.vsd file.At this point, we need to create two 1:N non-identifying
relationships, one between DEPARTMENT and EMPLOYEE and one between DEPARTMENT and PROJECT.
We will start with the relationship between DEPARTMENT and EMPLOYEE.

Creating a 1:N Non-identifying Relationship Between Two Tables:


1. Click-and-hold the Relationship connector object.
2. Drag the object into the E-R diagram, and drop it in a blank area of the E-R diagram. Release the
mouse button. The E-R diagram now appears as shown in Figure F-25.
3. Note that, unlike the simple line of the dynamic connector, the relationship connection has an
arrow head on one end, and a plain tail on the other end. The arrow head must connect to the
parent tablethe many side of a 1:N relationship, and the plain end must connect to the child
tablethe one side of a 1:N relationship. In this case, DEPARTMENT is the parent table, and
EMPLOYEE is the child table.
4. Also note that, unlike the dynamic connectorwhich, even when beautifully formatted, is just a
simple linethe relationship connector is a database object, and as soon as it is added to the to
the E-R diagram the Database Properties window for the relationship is displayed, as shown in
Figure F-25.
5. Click-and-hold the plain end of the relationship object, and move it towards the center of the
EMPLOYEE table. When the EMPLOYEE table is outlined in red, the connector is attached to the
table objectrelease the mouse button.
6. Click-and-hold the arrowhead end of the relationship object in the E-R diagram, and drag it
towards the center of the DEPARTMENT table. When the DEPARTMENT table is outlined in red,
the connector is attached to the table objectrelease the mouse button. The E-R diagram now
appears as shown in Figure F-26.

Note that, as shown in Figure F-26, the relationship connector has added a new column to the
EMPLOYEE table, named it DepartmentName, and labeled it as a foreign key. It did this despite the fact
that the column we want to use as the foreign key, Department, is already in the table. Why did this
happen, and how can we fix it?

It happened because the relationship connector does not give us a choice of an existing column for the
foreign key.5 Instead, it assumes that the foreign key column is not present, must be added, and should
be named the same as the referenced primary key.

This is actually the technically correct way to usually handle adding a foreign key to a table. As discussed
in Chapters 4 and 5, foreign keys are generally not included in entities in data models, but rather are

5
As discussed in Online Appendix E, the MySQL Workbench does provide a means of using an existing column as
the foreign key.

F-23
Database Processing Appendix F

The Relationship
connector object

The relationship
connectorthe
arrowhead attaches
to the parent table,
and the plain end
attaches to the
child tablethe
foreign key points
to the correspond-
ing primary key

The Relationship
database properties

Figure F-25 The Relationship Connector in the Database Design

The Relationship
connector object
the arrowhead point
to the table holding
the referenced pri-
mary key

A new column
named Depart-
mentName has
been added to EM-
PLOYEE and des-
ignated as a foreign
key (FK1)

The Relationship
in Database Prop-
erties

Figure F-26 The Attached Relationship Connector in the Database Design

added to tables when the database design is created. And, in fact, the only reason Department is already
in the EMPLOYEE table is because we are building this database design from an existing database design
as reflected in the SQL CREATE TABLE statements.

Now, how can we handle this situation? That is simplewe just need to edit the column definitions for
the EMPLOYEE table.

7. The Relationship connector, like the Dynamic Connector, is dynamic, which means that if we
move any of the objects to which the connector is attached, then the connector will

F-24
Database Processing Appendix F

automatically adjust its size and position to match. In Figure F-27, we have moved the
DEPARTMENT table towards the center of the E-R diagram, and the connector has ajusted itself
as needed.
8. Click the EMPLOYEE table to select it. The database properties for the EMPLOYEE table are
displayed in the Database Properties window.
9. In the Database Properties window, click the Columns category button. The Columns properties
for the EMPLOYEE table are displayed. Scroll though the columns row until you can see both the
Department and the DepartmentName column properties, as shown in Figure F-28.

The DEPART-
MENT table has
been moved toward
the center of the
diagram, and the
relationship con-
nector has adjusted

The relationship
connector object

Figure F-27 The Relationship Connector Dynamically Adjusts When DEPARTMENT Table is Moved

The Remove
button

The Department
column data

The Department-
Name column data

The Move Up
button

Figure F-28 Editing the EMPLOYEE Table Columns

F-25
Database Processing Appendix F

10. Note that the Data Type for DepartmentName is correct, but that the column is not currently
required.
11. Select the Department column, and then click the Remove button to delete this column from
the table.
12. Select the DepartmentName column. Edit the Physical Name to read Department, then click the
Reqd column to set the column as NOT NULL, and then click the Move Up button two times to
move the column into the position previously occupied by the former Department column. The
E-R diagram now appears as shown in Figure F-29.
13. Click the Relationship connector between EMPLOYEE and DEPARTMENT to select it and display
the database properties for the relationship.
14. In the Database Properties window, click the Miscellaneous category to select it. The Database
Properties window now appears as shown in Figure F-30.

The property settings on the Miscellaneous category page allow us to control minimum and maximum
cardinality settings, and whether the relationship is identifying or non-identifying. Currently the
relationship settings are for a non-identifying relationship, and the Parent-to-child relationship is 1 to 0
or more.

We will compare this to the column characteristics as shown in Figure F-8, and in the data model we
created previously as shown in Figure F-24. In Figure F-24, we indicated a non-identifying relationship, so
that setting is correct. But Figure F-24 also shows a mandatory parent (required N sideDEPARTMENT)
table and a mandatory child (required 1 sideEMPLOYEE ) table. Are these conditions set correctly?

The corrected EM-


PLOYEE table
Department is now
the foreign key
(FK1)

The Department
column data

Figure F-29 The Editied EMPLOYEE Table Columns

F-26
Database Processing Appendix F

The Miscellaneous
Identifying or non-
category page
identifying relation-
ship settings
Child table mini-
mum cardinality Parent table mini-
settings mum cardinality
settings
State relationship
cardinalities

Figure F-30 The Categories Miscellaneous Page

Looking at the Child has parent [ ]Optional check box in Figure F-30, we can see that the checkbox is not
checked, so the parent is mandatory. So the mandatory parent setting is correct.

Looking at the Cardinality radio buttons in Figure F-30, we see a set of choices. How these choices
correspond to the IE Crows Foot symbols in Figure 5-8 is summarized in the following table:

Figure 4-8 Symbol Meaning Microsoft Visio 2010

Mandatory One Exactly one

Mandatory Many One or more

Optional One Zero or one

Optional Many Zero or more

No symbol A specified range Range [At least][At most]

In Figure F-30, a cardinality of Zero or more is selected, which corresponds to a child (EMPLOYEE)
cardinality of Many-Optional. According to Figure F-24, this should be Many-Mandatory. Therefore, we
must set the database property cardinality to One or more.

F-27
Database Processing Appendix F

These choices cor-


respond to SQL ON
DELETE options

These choices cor-


respond to SQL ON
UPDATE options

The Miscellaneous
category page

Figure F-31 The Categories Referential Action Page

15. Click the Cardinality One or more radio button to select it.
16. In the Database Properties window, click the Referential Action category to select it. The
Database Properties window now appears as shown in Figure F-31.

In Figure F-31, we see that the Referential Action category page allows us to set options that correspond
to the options for the SQL ON UPDATE and ON DELETE phrases. Since Department name is not a
surrogate key, we should use ON UPDATE CASCADE for this relationship. We will probably never delete a
Department with Employees, so we should use ON DELETE NO ACTION. The Referential Action page
includes a Cascade option for ON CASCADE, but does not specify an action for ON DELETE. However, the
default action for both ON UPDATE and ON DELETE is NO ACTION, so this is the implied action of this ON
DELETE in this relationship.

17. In the On parent update list, check the Cascade radio button. The selected No action in the On
parent delete list is correct as it is.
18. Click the Save button on the Quick Action Toolbar to save the changes to the WPC-Database-
Design.vsd file.

This completes our work on the 1:N non-identifying relationship between DEPARTMENT and EMPLOYEE.
We now need to create a similar relationship between DEPARTMENT and PROJECT, and you should
create that relationship at this time, and then save the changes to the WPC-Database-Design.vsd file.
The updated E-R diagram is shown in Figure F-32.

F-28
Database Processing Appendix F

The 1:N non-


The 1:N non- identifying relation-
identifying relation- ship between DE-
ship between DE- PARTMENT and
PARTMENT and PROJECT
EMPLOYEE

Figure F-32 The Completed 1:N Non-identifying Relationships

At this point we still need to build the ASSIGNMENT table and its relationships with EMPLOYEE and
PROJECT. However, since, ASSIGNMENT is an association table in an association relationship with
EMPLOYEE and PROJECT (associaton relationships are discussed in Chapters 5 and 6), and since association
tables are just intersection tables with additional attributes (again, as discussed in Chapters 5 and 6), we will
use this as an opportunity to discuss how Microsoft Visio 2010 handles N:M relationships in database
designs.
As discussed in Chapters 5 and 6, an N:M relationship only exists in a data model (as a non-identifying
relationship between two strong entities). In a database design, the N:M relationship becomes two 1:N
ID-dependent identifying relationships linking the two original tables through a new, third table called
an intersection table. In Microsoft Visio 2010 database designs, the intersection table is not
automatically createdwe must build two 1:N relationships ourselves.
There is nothing new to discuss in terms of how to create these relationshipswe use exactly the same
steps we have discussed earlier. Figure F-33 shows the E-R diagram with an intersection table for the
assumed N:M relationship between EMPLOYEE and PROJECT as shown in Figure F-24. Figure F-34 shows
the ASSIGNMENT association table and relationships as by the column charateristics in Figure F-8.
After you complete adding the ASSIGNMENT table to the WPC-Database-Design.vsd file, save the file to
save the changes.
At this point, we should note that:

No matter what relationship settings you choose in the Database Properties window for a
relationship, the Relationship connector line in the E-R diagram never changes format!

F-29
Database Processing Appendix F

The PROJECT_EMPLOYEE_INT
intersection table

The 1:N ID-dependent identifying The 1:N ID-dependent identifying


relationship between relationship between
PROJECT-EMPLOYEE_INT and PROJECT-EMPLOYEE_INT and
EMPLOYEE PROJECT

Figure F

D-33 The E-R Database Design with an Intersection Table

The ASSIGNMENT association table

The 1:N ID-dependent identifying The 1:N ID-dependent identifying


relationship between relationship between
ASSIGNMENT and EMPLOYEE ASSIGNMENT and PROJECT

Figure F-34 The E-R Database Design with an Association Table

You can right-click on the Relationship connector line to display the short-cut menu, and then
choose Format | Line just like we did for the dynamic connector to display the Line dialog
box. In the Line dialog box, you can choose various formatting options like we did for the
Dynamic Connector. BUT, when you click the Apply button and the OK button nothing happens
(go ahead and try it yourself)! The Relationship connector line cannot be reformatted this way.

F-30
Database Processing Appendix F

And just what is the line drawn by the Relationship connector? Simply put, it is
using Microsoft Visio 2010s own unique E-R symbology. While we do not know
any particular name for it, Microsoft seems to refer to it as Relational symbology, and, as we will see,
does allow us to reformat the line ends to use IE Crows Foot notation. But this default notation is not IE
Crows Foot notation, IDEF1X notation, or UML notation! For our purposes, we will name it Microsoft
Visio Relational notation, and that will have to do.

Can we display our database design using our prefered IE Crows Foot notation? The answer is yes, and
we can do it by changing the Database Document Options.
Changing the Database Document Options:
1. Click the Database command tab to display the Database command groups, as shown in Figure
F-35.
2. Click the Display Options button in the Manage command group to display the Database
Document Options dialog box, as shown in Figure F-36.

In Figure D-36, note the we are give a choice of two symbol sets: IDEF1X and Relational. The Relational
symbol set is currently selected. If we wanted to use IDEF1X symbology, we would select it here.

The Database
command tab

The Display Op-


tions button

The Manage com-


mand group

Figure F-35 The Database Command Tab and Database Command Groups

F-31
Database Processing Appendix F

The Database The Relationship


Document Op- tab
tions dialog box

The General tab

The IDEF1X
symbol set

The Relational
symbol set

Figure F-36 The Database Document Options Dialog BoxGeneral Tab

The Database The Relationship


Document Op- tab
tions dialog box

The Relationships
check box

The Crows feet


check box
The Referential
actions check box
The Cardinality
check box
The Ok button

Figure F-37 The Database Document Options Dialog BoxRelationship Tab

3. In the Database Document Options dialog box, click the Relationship tab to display the
Relationship settings, as shown in Figure F-37.

In Figure F-37, note that the Relationships check box is the only option selected. With this set of options,
the E-R diagram uses Microsoft Visio Relational notation. Note, however, that there are options to
display:

Crows Foot notation in the E-R diagram.


Cardinality on the E-R diagram.
Referential integrity actions (ON DELETE CASCADE, etc.) on the E-R diagram.

4. Click the Crows feet checkbox to select it.


5. Click the OK button. The WPC-Database-Design drawing now displays IE Crows Foot notation, as
shown in Figure F-38.
6. Click the Save button to save the changes to the WPC-Database-Design drawing.
7. Close the WPC-Database-Design.vsd file.
8. Close Microsoft Visio 2010.

F-32
Database Processing Appendix F

The relationships
now use IE Crows
Foot notation

Figure F-38 The WPC Database Design With IE Crows Foot Notation

We will not discuss the other formatting options, but we do suggest you try them
out on your own and see exactly how the E-R diagram can be formatted when
using the Relationship connector.

We have completed our discussion of using Microsoft Visio 2010 as a tool for data modeling (as
discussed in Chapter 5) and database design (as discussed in Chapter 6).

How Do I Create Diagrams Using Business Process Modeling Notation (BPMN) in


Microsoft Visio 2010?
Business processes, and the need to study and document those processes is discussed in Appendix B.
This is referred to as business process modeling, and business process modeling notation (BPMN) is a
commonly used system for drawing business process models. Information systems are developed to
support those business processes, and when doing so we use the systems development life cycle (SDLC),
again as discussed in Appendix C.

While Database Concepts does not cover business process modeling in detail,6 we will note that news of
BPMN support for Microsoft Visio 2010 has been published by Microsoft. In particular, see the Microsoft
Visio Insights blog at http://blogs.msdn.com/b/visio/archive/2009/12/03/bpmn-support-in-visio-

6
For more information on business process modeling, see David M. Kroenke, Using MIS (4th edition) Upper Saddle
River, NJ: Prentice Hall: 2012, Chapter 10, David M. Kroenke, Experiencing MIS (3rd edition) Upper Saddle River, NJ:
Prentice Hall: 2012, CE 18, and the Object Management Groups Business Process Management Initiative Web
page at http://www.bpmn.org/ .

F-33
Database Processing Appendix F

2010.aspx , which has a good discussion of BPNM in Microsoft Visio 2010.

Unfortunately, full BPMN support is only available in the Visio Premium edition (see
http://office.microsoft.com/en-us/visio/visio-edition-comparison-FX101838162.aspx ). We say
unfortunate, because while the Visio Professional edition is often available to students (for example,
through the Microsoft Developer Network Academic Alliance [see: http://msdn.microsoft.com/en-
us/academic/default.aspx ]), the Visio Premium edition is not!

It is possible to open a blank Microsoft Visio 2010 drawing and search for BPMN objects. This will return
a large set of objects, but not neatly organized in the stencils shown in the Microsoft Visio Insights blog.
Further, the objects templates are not saved with the document, and you must do another search each
time you open the drawing. Objects actually in the drawing are, of course, saved as part of the drawing.

While a bit cumbersome, this does make BPNM objects available for use in the Visio Professional
edition, and if you want to explore BPMN, this is a place to start. You can also search for non-Microsoft
stencils on the Websome are available, but they are of varying quality.

F-34
Database Processing Appendix F

Key Terms

1:1 non-identifying relationship 1:N identifying relationship


1:N non-identifying relationship Backstage view
Business process modeling notation (BPMN) Cardinality radio buttons
Category object Category to child connector object
Child has parent [ ]Optional check box Columns category
Database Document Options Database Model Diagram template
Database Properties window Dynamic connector object
Entity object Entity Relationship (US units) button
Entity Relationship (US units) stencil File command tab
Format | Line command Microsoft Visio 2010
Microsoft Visio Relational notation Minimize the Shapes window button
More Shapes button More Shapes list
New tab Parent to category connector object
Physical data types (Microsoft Access) Physical name text box
Portable data types Relationship object
Software and Databases button Stencil
View object

Review Questions

F.1 What is Microsoft Visio 2010?

F.2 What is the Backstage view?

F.3 How do you create a new database model diagram drawing in Microsoft Visio 2010?

F.4 Describe the Shapes window, and the objects in the Shapes window.

F.5 What shapes are included in the Entity Relationship (US units) stencil, and what is the
purpose of each shape?

F.6 How do you create entities/tables in a database model diagram? When should these
objects be considered to be entities, and when should they be considered to be tables?

F-35
Database Processing Appendix F

F.7 Why would you want to save a database model diagram drawing with just
entities/tables in it?

F.8 When should you use the Dynamic connector object?

F.9 When should you use the Relationship connector object?

F.10 How do you format a Dynamic connector object so that it displays IE Crows Foot E-R
notation?

F.11 How do you connect a Relationship connector object to two tables? What significance is
there to which end of the Relationship connector is attached to which table?

F.12 How are Relationship connector cardinalities set? What is the correspondence between
the cardinality terms used in the database properties window and the IE Crows Foot E-R
notation shown in Figure 5-8.

F.13 How are Relationship connector referential actions set? What is the correspondence
between the referential action terms used in the database properties window and in
SQL statements?

F.14 How do you format the arrow notation used by the Relationship connector?

F.15 How can you use BPMN with Microsoft Visio 2010?

Exercises

F.16 If you havent already done so, work through the steps described in this appendix to
create the data model and database design for the WPC database.

F.17 Create a copy of the WPC-Data-Model.vsd file, and name it WPC-Data-Model-with-


ASSIGNMENT.vsd. Modify the data model to include the ASSIGNMENT table as shown in
the column characteristics in Figure F-8.

F.18 A data model for the Highline University database is shown in Figure 5-52. In Microsoft
Visio 2010, create a new Database Model Diagram drawing named HU-Data-Model.
Recreate the data model shown in Figure 5-52 in this drawing.

F.19 A database design for the Highline University database is shown in Figure 6-27. In
Microsoft Visio 2010, create a new Database Model Diagram drawing named HU-
Database-Design. Recreate the database design shown in Figure 6-27 in this drawing.

F-36
Database Processing Appendix F

F.20 The data model for the View Ridge Gallery database is shown in Figure 6-34. In
Microsoft Visio 2010, create a new Database Model Diagram drawing named VRG-Data-
Model. Recreate the data model shown in Figure 6-34 in this drawing.

F.21 The database design for the View Ridge Gallery database is shown in Figure 6-37. In
Microsoft Visio 2010, create a new Database Model Diagram drawing named VRG-
Database-Design. Recreate the database design shown in Figure 6-37 in this drawing.

F-37

You might also like