You are on page 1of 6

A Tutorial on MS Visio for ER Modeling

Weimao Ke wke@unc.edu School of Information and Library Science University of North Carolina at Chapel Hill February 24, 2009

Goals
to learn basic operations with MS Visio; to create conceptual Entity Relation (ER) diagrams using Visio;

ER Symbols of Notation

Figure 1: ER Symbols

3
3.1

Visio Basics
Download and Installation

MS Visio can be downloaded or checked out from the Web site: http://msdn04.e-academy.com/elms/Storefront/Home.aspx?campus=unc_lis If you have any problem, please contact SILS technical support Email: mailto:help@ils.unc.edu, Web: http://sils.unc.edu/itrc/its/index.html, or Phone: 962-8188.

3.2

Startup

After installation, you will nd MS Visio under: START All Programs Microsoft Oce Microsoft Oce Visio 2007. Figure 2 shows the MS Visio interface after being loaded:

Figure 2: MS Visio startup

3.3

Start a New Drawing

To start a new drawing, select menu item File New. . . New Drawing (US units) or simply press Ctrl + N. Then, select menu File Shapes General Block (US units) to load shapes needed to draw ER diagrams 1 , shown in Figure 3. For ER modeling, we will rely on these shapes: Box (for ENTITY), Diamond (for RELATIONSHIP), Circle (distorted to ellipse: for ATTRIBUTE), and Dynamic connector (line: for CARDINALITY/PARTICIPATION notation).
is an option under Shapes Software and Database Database Entity Relationship, which is useful for drawing database schemas, but not for conceptual ER modeling. In this tutorial, we rely on basic block shapes to draw ER diagrams.
1 There

Figure 3: New Drawing with Block Shapes

3.4

Basic Operations

If you like, select 100% from the Zoom dropdown box on the toolbar or select View Zoom 100% to view the actual size of the drawing sheet. Add a shape: Drag a related icon from the Shapes panel on the left to the drawing sheet (white page); Edit a label: Double click on the shape to edit its label/text; Resize a shape: Click on the shape to select and drag a selection handle (green small rectangles on the borders). Drag a corner handle to resize proportionally (Figure 4 (a)). Rotate a shape: Drag the rotation handle of a selected shape (a small green circle when a shape is selected, Figure 4 (a)). Move a shape: Select and drag a shape to the position you want (automatically snapped to the closest grid lines). To ne tune the position, select the shape and use the four direction arrow keys (Right/Left/Up/Down) to move the selected shape. Select multiple shapes: Starting from a blank area, mouse down and drag a dotted rectangle to cover FULLY all shapes you want to select. A shape is not selected if it is partially covered by the selection rectangle. Or, you can hold down your Ctrl key and select one shape at a time until you select all you want. Format and options: right click for more formatting and shape options. Tips: Look at toolbar icons for quick access to options, e.g., background color, line pattern/thickness, etc (Figure 5). This is useful especially when you have to repeat various operations. 3

(a) Resize

(b) Connect two shapes

Figure 4: Illustration of Operations

Figure 5: Useful Toolbar Icons, from left to right: Text Color, Line Color, Fill Color, Line Weight, Line Patter, and Line Ends.

4
4.1

ER-specic Operations
Basic ER Shapes
Box for ENTITY; Diamond for RELATIONSHIP; Circle (resized to ellipse) for ATTRIBUTE; Dynamic connector for CARDINALITY/PARTICIPATION;

4.2

Double-bordered Shapes

For WEAK ENTITY, IDENTIFYING RELATIONSHIP, and MULTIVALUED ATTRIBUTE, we can combine two shapes to form a shape with double-lined borders. The following illustrates how a weak entity can be drawn. Similar techniques can be applied to the others. 1. Draw a larger Box and remove text/label from it (Figure 6 (a)); 2. Draw a smaller Box, remove text from it, and move it on top of the larger Box (Figure 6 (b)); 3. Select both, right click to select menu Shape Group (Figure 6 (c)).

4.3

Dotted-bordered Shapes

If you need a shape with dotted/dashed borders (e.g., a DERIVED ATTRIBUTE), simply select the shape you have drawn and select the dotted line pattern using the Line Pattern toolbar icon (click on the small drop-down arrow of the icon, Figure 5).

(a) Larger box

(b) Smaller Box Figure 6: Draw a double-lined shape

(c) Group/combine

4.4

Connect Two Shapes

Drag a Dynamic connector to the drawing sheet and move one end to a connection point of each shape you want to connect (Figure 4 (b)). The connection point will be activated and the line end snapped to it (glued). Once glued, connections stay even when shapes are moved. Double click the line to enter text, e.g., to dene cardinality 1 or N/* to the line. Right click on the line and select the type of line you like, e.g., Right-Angle Connector, Straight Connector, or Curved Connector.

4.5

Key Attribute

Draw an attribute using the Circle shape and label it. Select the shape and click the Underline toolbar icon (or simply press Ctrl + U). Or, you can draw a circle and a straight (horizontal) line and group them.

Useful Hotkeys
Ctrl + D: to duplicate a selected shape (or multiple shapes selected); Ctrl + N: to new a drawing; Ctrl + U: to underline text; Ctrl + Shift + R/C/L: to align (text) right/center/left.

6
6.1

Practice
Next Construction Example

Workers are assigned to buildings to work on various assignments. Workers and buildings are identied with unique identiers. Workers can be assigned to more than one building and multiple workers can be assigned to a single building. Workers have various skills. [See class 5 slides.]

6.2

Design Steps (from class 5 slides)

1. Establish entities 2. Establish attributes and keys (if possible) 3. Check entities 4. Establish relationships 5. Establish cardinalities 6. Identify aggregates 7. Establish attributes for aggregates 8. Check relationships 9. Check model for completeness 10. Transform to schema

Additional Resources
I have created a set of ER symbols in Visio, available at: http://miksa.ils.unc.edu/courses/inls523/lectures/. Feel free to reuse them. Computer-base training on Visio: http://cbt.unc.edu.

You might also like