You are on page 1of 12

Entity Relationship Modeling using ERwin

To start ERwin, click on StartProgramsCAERwinERwin Data Modeler


r9ERwin Dtata Modeler.

The first time you use ERwin, a screen similar to the one below will appear. Under
Concurrent Licenses, select the Acquire concurrent use Standard Edition license
option and provide the server path as specified in the screenshot below.

Initial Settings
Prior to creating our entities and relationships, configure the necessary settings to
optimize your view of the model. First, change your workspace properties to display
keys, data types and relationship names.
To display the attribute data type, right click on an empty area in the workspace and
select Properties. Under the Entity tab at the bottom, check the options to
Display Attribute Data Type and Display Logical Primary Key (PK) Designator.
Under the Relationship tab, check the option to Display Logical Relationship
Name and Display Physical Relationship Name. Close the properties window.

Before creating a relationship, ensure that your model is configured to display


Crows Foot notation. To do this, click on the Model menu and select Model
Properties. In the Model Properties dialog, choose Information Engineering as
the logical and physical notation.

Creating a new model


To create a new data model, Click on FileNew.

Select Logical/Physical as the model type. Other fields can be left with default
values, or can select the target server based on the DBMS platform for which you
are modeling.

A screen similar to the one below will appear. You are ready to start modeling!

Representing Entities and Attributes


To create a new entity, click on the Entity icon and then click a location in the blank
workspace.

A new Entity will be displayed in the workspace.

Alternately, you can right-click in the Model Explorer on Entities and select New

A new entity will be created under the Entities in Model Explorer, which you can
click and drag into the workspace.

Edit the default entity name by clicking on the entity name and entering a more
descriptive name as shown below. Alternately, the entity name can be edited by
opening the entity editor. Double clicking the entity will open the editor.

Create two entities, named Band and Album.

Defining Attributes
Primary key attributes will be displayed in the upper portion of each entity (above
the line) and remaining attributes will be displayed in the lower portion of each
entity. To define attributes, right-click the entity in the workspace and choose
Attribute Properties.

The following screen will appear. To create attributes, click the New icon and
enter the information for each attribute as appropriate.

After entering the attributes for both entities, the workspace should look similar to
the one below. If you wish to change the properties of an attribute, right click on
the entity or attribute and select the appropriate option to edit the properties.

Representing Relationships
Relationships between entities can be created as identifying, non-identifying, and
many-to-many. Most relationships will be created as non-identifying. Create a nonidentifying relationship between Band and Album by clicking the Non-identifying
relationship icon on the toolbar, then clicking on the Band entity and dragging
the relationship onto the Album entity. Alternately, in the Model Explorer
window, right-click Relationships and select New. Band will be the parent and
Album will be the child in this relationship (be sure to change the relationship type
here as well).

Note that a Foreign Key (FK) attribute was automatically created in the child table
(Album in this example), and the name of the relationship was populated by a
default value. To change the name of this relationship, double-click on the name to
edit it, or open the properties screen for the relationship and edit it from there.
Note two other important settings on the relationship properties screen.
The Null Option selection will indicate whether null values are allowed in the FK
field. If you wish for the cardinality on the one side of the relationship to be
mandatory, select Nulls Not Allowed, meaning that any record in the child table
(Album in this example) must be associated with a record in the parent table (Band
in this example).
To specify the cardinality on the many side of the relationship, select the
appropriate option from the Cardinality selection list: Zero, One or More for one-

to-optional-many, One or More (P) for one-to-mandatory-many, or Zero or One


(Z) for one-to-optional-one.

You have created your first data model using ERwin! Now save your work (if you
havent already) . Instructions for saving are below.

Saving the Data Model


From the File menu, select Save As and navigate to the folder where you want
to save the model.

Exporting to PDF
To export your model to PDF, click on the Tools menu and select Pinned
ReportsCurrent Diagram Membership (Logical).rpt

On the following screen, click on the File menu and select Export.

Under Save as type, select PDF (*.pdf). Then, navigate to the folder where you
want to save the PDF, enter a name for the file, and click Save.

You might also like