0% found this document useful (0 votes)
555 views13 pages

Creating Database Diagrams in Visio

The document describes how to create database model diagrams using Microsoft Visio. It explains how to open the database model diagram template, create entities and attributes, and draw relationships between entities. Key entities like "Site" are modeled with attributes like primary and foreign keys automatically added to linked entities. The template and shapes make it simple to build entity relationship diagrams in Visio.

Uploaded by

Bakhtawar
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)
555 views13 pages

Creating Database Diagrams in Visio

The document describes how to create database model diagrams using Microsoft Visio. It explains how to open the database model diagram template, create entities and attributes, and draw relationships between entities. Key entities like "Site" are modeled with attributes like primary and foreign keys automatically added to linked entities. The template and shapes make it simple to build entity relationship diagrams in Visio.

Uploaded by

Bakhtawar
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

Creating

Database Model Diagrams in Microsoft Visio


Jeffery S. Horsburgh

Visio is a software tool created by Microsoft that contains tools for creating many different types of
diagrams. Visios drawing templates and pre-defined shapes can simplify the creation of a diverse set of
diagram types. The following sections provide details for how to create a data model entity-
relationship diagram using Visios Database Model Diagram template.

Creating a New Database Model Diagram

Open Visio by clicking Start All Programs Microsoft Office Microsoft Visio 2010.

Visio will open and ask you to choose a template. In the Template Categories, choose Software and
Database.



From the Software and Database template list, choose Database Model Diagram and then click the
Create button.

1



Visio will create a new drawing and will select the types of shapes that are needed for you to create a
new entity relationship diagram for your data model. You can zoom in and out on your diagram by using
the zoom controls at the bottom of the Visio window.


2


Creating Entities

To create new entities in your drawing, click on the Entity shape in the Shapes panel on the left and
drag a new shape onto the drawing. A new entity called Table1 will appear on the drawing.



To adjust the location of an entity on your drawing, click on an entity and then drag it to a new location.

Naming and Adding Attributes to Entities

When you click on an entity in the drawing you will notice that it becomes selected and the panel at the
bottom of the window will reflect the properties of the selected entity.

3



To set the name of an entity, select Definition under the list of categories and then type the name of
your entity into the Physical Name text box.

4


To add attributes to your entity, select Columns under the list of categories. In the table that appears,
click in the Physical Name field in the first row and type an attribute name. You can set an appropriate
data type in the Data Type field and then decide whether that attribute is required to have a value and
whether it should be used as the entitys primary key. You can add additional attributes at any time by
selecting the shape and then typing an attribute name in the next empty row in the table.



A finished Site entity might look like the following. The primary key attribute is designated at the top
of the entity and required attributes are shown in bold text.

5



Creating Relationships

Relationships between entities are created by first dragging a relationship from the shapes panel on the
left onto the drawing. Then click on the relationship shape to select it, you will notice that there are now
selection handles on either end of the shape (the little squares).

6

Next, click on the selection handle for the parent end of the relationship and drag it over the
corresponding parent entity. When you drag the end of the relationship over the center of the entity
that you want to connect it to, the entity will be outlined in red, at which point you can release your
mouse click. That end of the relationship will then be connected to the selected entity. Visio will
randomly assign a connection point. Remember that the end of the relationship with the arrowhead
should point to the parent entity and the other end to the child entity. Click the selection handle for
the child end of the relationship and drag it to the child entity. Your relationship should now be
connected to both entities.



You will notice that when you connected the child end of the relationship to the child entity, the primary
key attribute from the parent entity was automatically added to the child entity as a foreign key
attribute. You will also notice that in the properties of the relationship at the bottom of the window
(under the Definition category) Visio is showing which attributes in each entity are participating in the
relationship (the SiteID attribute in both of the entities in the example above).

Under the Miscellaneous category of the relationship properties you can set the cardinality of the
relationship. In this particular type of Visio diagram the cardinality options are those for the child entity.
In this example, you would be telling Visio how a site entity is related to observations. In this
example, the most likely relationship is for one site to be related to Zero or more observations.

7



To display the set cardinality on your diagram, select the Database tab at the top of the window and
then select the Display Options button on the ribbon under the Manage group. In the window that
pops up, make sure Relationships and Cardinality are selected under the list of objects to show and
then click the OK button.

8


You will notice that the cardinality is now shown for the relationship in your drawing.

Modifying Relationships

You may find it necessary at some point to modify what Visio creates by default when you add
relationships between entities. Or, you may want to be able to create multiple relationships between
two entities. For example, you may have defined a Variables entity that has attributes called
VariableUnitsID and TimeSupportUnitsID that you want to relate to an entity that defines attributes
of Units. This will require two relationships between the two entities. When you add the first
relationship between the Units entity and the Variables entity (see the following example), Visio will
automatically add an attribute called UnitsID to the Variables entity.



To change the foreign key for the relationship, select the relationship by clicking on it. Then under the
Definition category of the properties for the relationship, select the primary key from the parent
entity by clicking on it (in this example UnitsID) and the name of the child entity attribute that you
want to participate in the relationship instead of the new UnitsID attribute that was automatically
added (in this example VariableUnitsID). Then click the Associate button.

9



Once you click the Associate button you will notice that the relationship has been modified such that
the primary key of the parent entity (in this example UnitsID) has now been connected to the new
foreign key in the child entity (in this example VariableUnitsID) see below.

10



The UnitsID attribute that was automatically created when you linked the two entities with the
relationship can be deleted by selecting the Variables entity by clicking on it and in the Columns
category in the properties of the Variables entity select the UnitsID attribute and click the Remove
button.

11



If you need to add an additional relationship between two entities, you can use the process described
above. In this example, I also need a relationship between UnitsID in the Units entity and
TimeUnitsID in the Variables entity. The result looks like the following:

12



Exporting the Diagram

When you finish your drawing, you will want to export it as an image so you can paste it into a Word
document as an appendix. At the top of the Visio window, click the File tab and then choose Save As
in the list on the left panel of the window. In the Save As dialog that comes up, choose where you
want to save the file, give it a name, and select a format for your exported drawing. JPEG files generally
work well for pasting into documents as figures, so choose JPEG File Interchange Format from the
Save as type drop down control. Then click Save. The following window will pop up:



You will want to make sure that you export the image with enough resolution that it is not blurry when
you print it. For most purposes a Custom resolution of 150 X 150 pixels per inch will work great.
When you have set the resolution click the OK button to generate the image. You can then insert the
image into a Word document.

13

Common questions

Powered by AI

Visio provides several methods for customizing both the location and naming of entities within a database model diagram. Users can relocate entities by clicking and dragging them to a desired position on the drawing canvas. Entities can be renamed through the properties panel: select the entity, navigate to the 'Definition' category, and type the desired entity name into the 'Physical Name' box. Additional attributes can be added or adjusted under the 'Columns' category, providing full customization capabilities .

When exporting a Visio diagram as an image for use in documents, consider the file format and resolution. The JPEG File Interchange Format is recommended for easy insertion into text documents. Ensure the image is exported at a sufficient resolution, typically 150 x 150 pixels per inch, to avoid blurriness in print. Adjust these settings in the 'Save As' dialog under 'Custom resolution' before saving to guarantee clarity and quality of the diagram in its new format .

To create a new database model diagram in Microsoft Visio, first open Visio and choose 'Software and Database' from the Template Categories. Next, select 'Database Model Diagram' and click the 'Create' button, which opens a new drawing. Visio provides tools to zoom and manage the diagram. New entities can be created by dragging 'Entity' shapes from the 'Shapes' panel onto the drawing canvas .

Creating multiple relationships between two entities in a Visio database model might be necessary when an entity has several attributes that relate differently to the same entity. For example, if a 'Variables' entity includes attributes like 'VariableUnitsID' and 'TimeSupportUnitsID', each may relate to different aspects of a 'Units' entity. To accomplish this, create separate relationship instances for each pair of attributes by selecting the proper primary and foreign keys and using the 'Associate' button. This allows individualized association rules between the two entities .

In Visio, relationships between entities are created by dragging a relationship shape from the 'Shapes' panel and connecting it between the 'parent' and 'child' entities. The relationship is established by linking the selection handles to the respective entities, automatically adding the parent's primary key as a foreign key to the child entity. The properties panel allows users to define the attributes participating in the relationship, and the cardinality can be set to control how entities are related, such as 'one-to-many.' Multiple relationships can be added between two entities if needed, adjusting foreign keys accordingly within the properties menu .

Microsoft Visio simplifies the creation of entity-relationship diagrams by providing a Database Model Diagram template. This template includes pre-defined shapes and tools that are specifically geared towards modeling data structures. Visio allows users to easily create and manage entities by dragging and dropping shapes onto a canvas, and by offering properties panels to name entities, add attributes, define data types, and establish primary keys. Relationships between entities are visually represented and can be created by connecting parent and child entities directly through the diagram interface, with Visio automatically reflecting relational changes such as adding foreign keys .

To modify a relationship to use specific attributes for foreign keys in Visio, select the relationship and go to the 'Definition' category in the properties panel. Choose the primary key from the parent entity and the desired attribute in the child entity instead of the default foreign key generated by Visio. Click the 'Associate' button to apply these changes. By doing this, the primary key of the parent entity is explicitly linked to the chosen foreign key in the child entity, allowing greater control over the data structure and relationships .

When establishing relationships between entities in Visio, the software automatically handles the addition of attributes by adding the primary key of the parent entity as a foreign key attribute to the child entity. This occurs upon connecting the relationship lines with the selection handles, ensuring that referential integrity is maintained automatically. Users can further customize or adjust these attributes by accessing the properties panel after the relationship is defined .

To set the cardinality for relationships in a Microsoft Visio database diagram, first create the entity relationship and then access the relationship properties. Under the 'Miscellaneous' category, specify the cardinality for the child entity, detailing how a single parent entity can relate to multiple child entities, for instance 'Zero or more'. For visual display, access the ‘Database’ tab, click on 'Display Options', and check the 'Relationships' and 'Cardinality' boxes in the list of objects to show. The cardinality will then be visible in the diagram .

To remove an automatically generated foreign key and establish a user-defined foreign key relationship in Visio, first, select the entity containing the unwanted foreign key attribute, navigate to the 'Columns' section in the properties panel, select the attribute, and click 'Remove'. Next, ensure the relationship is selected, go to 'Definition' in the properties and choose the primary key of the parent entity and the desired attribute name in the child entity. Click 'Associate' to link them directly, thus reflecting the intended relationship structure .

You might also like