Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds

Data Modeling with ERWin

Save for later
  • 3 min read
  • 14 Oct 2009

article-image

Depending on your data modeling need and what you already have, there are two other ways to create a data model: Derive from an existing model and Reverse Engineer an existing database.


Let’s start with creating a new model by clicking the Create model button.

data-modeling-erwin-img-0


We’d like to create both logical and physical models, so select Logical/Physical.

data-modeling-erwin-img-1


You can see in the Model Explorer that our new model gets Model_1 name, ERWin’s default name.

data-modeling-erwin-img-2


Let’s rename our model to Packt Model.

data-modeling-erwin-img-3

data-modeling-erwin-img-4


Confirm by looking at the Model Explorer that our model is renamed correctly.

data-modeling-erwin-img-5


Next, we need to choose the ER notation. ERWin offers two notations: IDEF1X and IE. We’ll use IE for our logical and physical models.

data-modeling-erwin-img-6

data-modeling-erwin-img-7


It’s a good practice during model development to save our work from time to time.

data-modeling-erwin-img-8

data-modeling-erwin-img-9


Our model is still empty, so let’s next create a logical model in it.

Logical Model


Logical model in ERWin is basically ER model. An ER model consists of entities and their attributes, and their relationships. Let’s start by creating our first entity: CUSTOMER and its attributes.

To add an entity, load (click) the Entity button on the toolbar, and drop it on the diagramming canvas by clicking your mouse on the canvas.

Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at £15.99/month. Cancel anytime

data-modeling-erwin-img-10

data-modeling-erwin-img-11


Rename the entity’s default E/1 name to CUSTOMER by clicking on the name (E/1) and typing its new name over it.

data-modeling-erwin-img-12


To add an attribute to an entity, right-click the entity and select Attributes.

data-modeling-erwin-img-13


Click the New button.

data-modeling-erwin-img-14


Type in our first attribute name (CUSTOMER_NO) over its name, and select Number as its data type, and then click OK.

data-modeling-erwin-img-15

data-modeling-erwin-img-16


We want this attribute as the entity’s primary key, so check the Primary Key box.

data-modeling-erwin-img-17


In the same way, add an attribute: CUSTOMER_NAME with a String data type. Our CUSTOMER entity now has two attributes as seen in its ER diagram. Notice that the CUSTOMER_NO attribute is at the key area, the upper part of the entity box; while the CUSTOMER_NAME is in the common attribute area, the bottom part.

data-modeling-erwin-img-18


Similarly, add the rest of the entities and their attributes in our model. When you’re done, we’ll have six entities in our ER diagram. Our entities are not related yet.

To rearrange the entities in the diagram, you can move around the entities by clicking and dragging them.

data-modeling-erwin-img-19