Draw Entity Relationship Diagram (ERD)

Entity relationship diagram (ERD) is a kind of diagram for presenting visually the structure of relational database. In this tutorial we will make use of ERD to model the database structure of a simple bus route management system.

May 19, 2010
User Rating: / 167
Views: 254,885
PDF Link Add comments
Edition: Community or above (Edition comparison)

  1. Start Visual Paradigm. Select a new workspace folder for this tutorial.
  2. Select File > New Project to create a project. Name the project as Bus Route Management and confirm.
  3. Create an Entity Relationship Diagram. Right click on Entity Relationship Diagram in Diagram Navigator and select New Diagram from the popup menu.
    new erd
  4. This creates an ERD. Name the diagram Bus Route Management at the top left corner of the diagram, and press Enter.
    name diagram
  5. Let's start by creating the first entity Route. Select Entity in diagram toolbar and click on the diagram to create an entity. Name the entity Route and press Enter to confirm.
    entity route created
  6. Create columns in Route. Let's start with a primary key. Right click on entity Route and select New Column from popup menu.
    new col
  7. Enter +id : varchar(10) and press Enter. Note that the + sign means that the column is a primary key. Varchar is the column type and 10 is the length.
    id added
  8. Enter fare : float and press Enter, then Esc to create another column.
    fare col added
  9. Create entity Stop. A bus route have many bus stops, while a stop can be shared by many routes. Therefore, there is an many-to-many relationship between Route and Stop. Move the mouse pointer over Route and press on the resource icon Many-to-Many Relationship.
    many to many
  10. Drag it out and release the mouse button. Name the new entity Stop, You can see that a linked entity Route_Stop is automatically created in between Route and Stop, with foreign key added.
    stop created
  11. Create the following columns in Stop:
    Key Name Type
    PK id int(10)
      name varchar(255)
      terminus blob

    The diagram should now become:
    cols added
  12. A route have multiple bus schedules. Create an entity Schedule from Route with a one-to-many relationship. Move the mouse pointer to Route, Make use of the resource icon One-to-Many Relationship to create entity Schedule.
    create one to many entity
  13. Create the following columns in Schedule:
    Key Name Type
    PK id int(10)
      departure date
      arrive date
  14. A schedule is handled by a bus. Create an entity Bus from Schedule, with an one-to-one relationship. Create the following columns in Bus:
    Key Name Type
    PK vehicle_id int(10)
      fleet_id varchar(10)
      last_main date

    The diagram should become:
    bus created
  15. A bus is driven by a bus driver. Create entity Driver from Bus with a one-to-one relationship. Add the following columns to Driver:
    Key Name Type
    PK id int(10)
      name varchar(255)
      employ_date date

    This is the final ERD.
    diagram done

Related Links

  1. YouTube Video: How to Generate DDL from Your ERD
  2. YouTube Video: Generate EJB Diagram from ERD
  3. YouTube Video: Draw Many to Many Relationship
  4. YouTube Video: Compare Logical and Physical Data Model Using Visual Diff
  5. Visual Paradigm Tutorial: From Data Modeling to Data Dictionary

Rate this Article

Click on one of the stars below to rate this article from 1 (lowest) to 5 (highest).

You may be interested in

  1. Data Flow Diagram (DFD) Tutorial
  2. Writing Effective Use Case
  3. Share Design, Discuss Design with PostMania
    Tagged:
  4. How to Organize Diagrams with Package?
    Tagged:
  5. How to Draw SoaML Diagrams?
    Tagged:
Tags of this article:

Comments (28)

written by richard on July 15, 2010

Good easy to follow example for someone like me just starting/learning.
It appears the instructions above for 14 creating the entity Bus are incorrect
(should be- vehicle_id not id).
Also 15 (should be- Finally, create entity Driver from Bus, with an one-to-one relationship. Create the following columns in Driver.)

written by Bartek on August 6, 2010

Looks wrong
15. A bus is driven by a bus driver. Finally, create entity from Bus with a one-to-one relationship.
Create an entity Bus from Schedule, with an one-to-one relationship. Create the following
columns in Bus:

written by Michael on August 24, 2010

Using this sample, can you tell me how I would show which tables contribute to a view. I've created a view entity but I'd like to show which tables make up the view visually but don't see a way to do that. Thanks in advance.

written by ghattamaneni on December 4, 2010

this is very easy to understand who is initially learners for E-R diaghrams

written by Jick Yeung on January 10, 2011

Hi Richard and Bartek,

Thank you for pointing out the mistakes. All issues are now fixed.

Best regards,
Jick Yeung

written by Thileep vec on February 1, 2011

excellent tutorial for basic learners of E-R diagram in visual paradigm

written by Ashique on February 9, 2011

The way of explanation is good,
and easy to follow for a beginner like me.

regards,
ash

written by Graham on March 2, 2011

Excellent tool for generating ERDs, I'm sure my students will make great use of this tool.

written by caci on March 12, 2011

In the entity diagram J have a primary key, and J wanna to have a secundary key in a new column, how to do that?

Sorry about my english.

written by caci on March 12, 2011

hhhh in the relationship specification we can mark the colum from some entity with the foreign key (at school we caled it secundary key, it is more logicaly :) and at the screen he apear with the green arrow !
Thanks anyway!

written by JouBSTi on July 26, 2011

Is it also possible to show user types in the diagram?
I can't find any setting to realize that.

written by Jick Yeung on July 26, 2011

Dear JouBSTi,

You can show the user type defined in column specification window. Please try this:
1. Right click on the background of diagram
2. Select "Presentation Options > Entity Columns Display Options > Show Column User Type" from the popup menu.

Best regards,
Jick Yeung

written by M Zeino on July 27, 2012

Hi!

Does anyone know how to implement "IS-A" in ERD using VP?

written by sohaib on February 10, 2013

how to create one-to-one optional in ERD through uml pairadigm

written by Jick Yeung (VP) on February 14, 2013

Hi sohaib,

You can set the cardinality via the specification of a relationship. Try this: Create a one-to-one. Right click on the connector and select Open Specification... from the popup menu. In the specification window, select "Zero or One" as the Cardinality of the to-side.

Best regards,
Jick Yeung

written by Richa Nigam on May 28, 2013

I am asking again & again how to create database for .net & mysql because everywhere u r creating database for java because i am not getting what is to be select in adapter & driver place when i am going through tools then database configuration (after creating ER Diagram) & i sent alot of mails regarding this but no body didnt reply for this & same for how to create class diagram using ER diagram.

written by Rain Wong on May 28, 2013

Hi Richa,

You can simply press the Green Arrow button next to the Driver file and Adapter file field to let VP download the files for you. Please make sure you have run the application with Admin permission (right click on the executable and select Run as administrator), and also with proper proxy server setting specified (if you need proxy for access Internet).

BTW, we seems only receive 2 email request from you. As I know our support team are checking with you about your other requests. Feel free to contact us for any questions.

Best regards,
Rain Wong

written by Muhumuza chris on September 2, 2013

I have a question:
Now think about a University in terms of an ERD. What entities, relationships and attributes might you consider.
Thanks for your support.

written by Jick Yeung (VP) on September 6, 2013

Hi Muhumuza,

Thank you for your post. I am afraid there is no definite answer because it depends on the system you are going to develop. Could you tell me more about your case?

written by Jick Yeung (VP) on October 24, 2013

I regret that we do not help our clients finish their works. But if you have any questions when you are drawing your ERD, you can ask and we will try our best to help.

written by muhumuza chris on October 24, 2013

Thanx for yo help.Chris

written by sanderz on October 24, 2013

nice example thanks for this i have an idea for my project :D

written by PL Sivakami on January 25, 2014

this system is actually amazing. does fleet_id in bus and id in driver are the same? if not could you please explain me the difference between the two? also kindly let me know what is last_main in bus? as i'm a beginner, I couldn't understand few concepts fully. thanks in advance

written by Jick Yeung (VP) on January 27, 2014

Hi PL Sivakami,

fleet_id in bus and id in driver are different. Let's say if a bus belong to a fleet called "Dragon", then it may have "DRG" as its fleet ID. id of driver is for uniquely identifying every single driver in the bus company. last_main stands for the last maintenance date. As you can see, it's in "date" type because its value is supposed to be a date.

written by sandhya on March 10, 2014

I have a dfd and that im in a big confusion that how do i change that dfd to an er diagram can any one help me out

Thanks in advance

written by Elad on April 24, 2014

Hi,
How Can I create SuperType and SubType in ERD?
It's suppose to become an abstract class in the class diagram (in UML diagram).

Thanks in advanced,
Elad

written by swati on August 27, 2014

Pls help me to draw a ER Diagram for a website pl

written by Jick Yeung (VP) on August 28, 2014

Hi Swati,

Thank you for your post. Please submit a ticket to our support team. We can discuss your case and pricing in details. To submit a ticket please visit:
http://www.visual-paradigm.com/support/

Write comment

Rating

Comment

Enter the calculation result

security code