Drawing Entity Relationship Diagram

ERD, short form for Entity Relationship diagram is a kind of diagram for presenting the properties as well as the relationships between data or participants. Database designer uses ERD to model physical structure of a relational database, while business analyst uses ERD to model the data that is logically required or produced by processes. In this page you will learn how to draw entity, how to add column and how to create relationship between entities.

Creating Entity Relationship Diagram

  1. Select Diagram > New from the application toolbar.
  2. In the New Diagram window, select Entity Relationship Diagram.
  3. Click Next.
  4. Enter the diagram name and description. The Location field enables you to select a model to store the diagram.
  5. Click OK.
  6. This creates an Entity Relationship Diagram. At the top right corner of the diagram, select the Data Model. All entities created in this diagram will be set to the chosen data model. And note that only entities in physical model will be included in generating database/DDL.

Drawing an entity

To draw an entity, select from the diagram toolbar and then click on the diagram. An entity will be created.

Entity created
Entity created

Adding column into entity

To add column into entity:

  1. Right click ont he entity and select New Column from the popup menu.
    To create a new column
    To create a new column
  2. A column is added. Enter its name in the pattern COL_NAME : COL_TYPE where COL_TYPE is the data type of column.
    Naming a new column
    Naming a new column
  3. Press Enter to confirm.
  4. Now, you can repeat step 2 and 3 to add more columns. When finished editing, press Esc to confirm.
    Columns created
    Columns created

Modeling MySQL 'Set type'

SET columns in MySQL allows the definition of columns that can contain a given set of values. In Visual Paradigm you can model a set type with the steps below:

  1. Add a column into the entity.
  2. Right click on the column and select Open Specification... from the popup menu.
  3. Select varchar to be the Type of column.
  4. Enter the definition statement in the User type field, in pattern SET('a','b','c', ...) where 'a', 'b', 'c'... are the allowed values of this column.
    Defining user type
    Defining user type
    NOTE: The User type field is only available when the DBMS selected in database configuration supports the definition of user type. E.g. MySQL.
  5. Click OK to confirm. Note that the definition will also be effective in database and DDL exporting.

Specifying primary key

There are several ways you can take to specify a column as a primary key. When inline editing, you can type + before the column name to indicate that the column is a primary key column.

Specifying a primary key
Specifying a primary key

Alternatively, right click on a column and select Include in Primary Key to set the column as primary key or include it as part of a composite key. Finally, you can also find and check the Include in Primary Key option in the Column Specification window. To open the window, right click on a column and select Open Specification... from the popup menu.

Clustered and non-clustered primary key

The use of clustered primary key may make the querying of data more efficient. To make a primary key of an entity a clustered/non-clustered primary key:

  1. Right click on that entity and select Open Specification... from the popup menu.
  2. Open the Columns tab.
  3. Select Clustered/Non-Clustered for Primary key clustered.
  4. Click OK.

Hiding nullable icons in ERD

In case you want to hide the nullable icon (as represented by symbol N) in ERD, you can follow the steps below: Right click on the diagram > Presentation Options > Entity Columns Display Options> Column Constraints Presentation Option> uncheck Show Nullable.

Selecting all columns in an entity

To select all columns within an entity, select any column first, and then press Ctrl-A to select the rest.

Working with relationships

Creating an entity with relationship

Relationship shows how the entities are related to each other. You can create a related entity by performing the steps below:

  1. Move your mouse pointer over the source entity.
  2. Press on the Resource Catalog button and drag it out.
    Using Resource Catalog
    Using Resource Catalog
  3. Release the mouse button at the place where you want the entity to be created.
  4. In Resource Catalog, select the kind of relationship to be created. If you want to create an entity with a one-to-many relationship, select One-to-Many Relationship -> Entity.
    To create an entity
    To create an entity
  5. You should see the entity now and it is connected to the source entity. Enter its name and press Enter to confirm editing.
    Entity created
    Entity created

Connecting to existing entity

To connect to en existing entity:

  1. Move your mouse pointer over the source shape.
  2. Press on the Resource Catalog button and drag it out.
    Using Resource Catalog
    Using Resource Catalog
  3. Release the mouse button at the target entity.
  4. In Resource Catalog, select the kind of relationship to be created.
    To create a one-to-many relationship between entities
    To create a one-to-many relationship between entities
    The entities are now connected with the relationship you chose.

Linked entity in many-to-many relationship

When you create a many-to-many relationship, a linked entity will be created, with two one-to-many relationships connected to it from the source entities.

Linked entity
Linked entity

 

Identifying and non-identifying relationships

 

There are two types of relationships - identifying and non-identifying.

Identifying relationship specifies the part-of-whole relationship. It means that the child instance cannot exist without the parent instance. Once the parent instance is destroyed, the child instance becomes meaningless.

Non-identifying relationship implies weak dependency relationship between parent and child entities. There are two kinds of non-identifying relationships, including optional and mandatory. The necessity of the parent entity is "exactly one" and "zero or one" in the mandatory and optional non-identifying relationship respectively.

Related Resources

The following resources may help you to learn more about the topic discussed in this page.

 
Chapter 2. Designer Guides Table of Contents 2. Conceptual, Logical and Physical Data Model
 

Technical Support

Have technical issues or suggestions? Please contact Visual Paradigm Support Team.

Sales Support

Have questions related to registration, licensing or payment? Feel free to contact Visual Paradigm Sales Team.

Discussion Forum

Share your suggestions of opinions at VP Discussion Forum.