Search This Blog

Thursday, April 28, 2016

Tutorial - How to Draw Entity Relationship Diagram (ERD)

Drawing 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 the ERD tool to model the database structure of a simple bus route management system.
August 24, 2015
User Rating: / 293
Views: 362,626
PDF Link Add comments

  1. Create a new project by selecting Project > New from the application toolbar. In the New Project window, enter Bus Route Management as project name and click Create Blank Project.
  2. To create an ERD, select Diagram > New from the toolbar. In the New Diagram window, select Entity Relationship Diagram and click Next. Enter Bus Route Management as diagram name and click OK.
  3. 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.
    select entity in diagram toolbar
  4. 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
  5. 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
  6. Enter fare : float and press Enter, then Esc to create another column.
    fare col added
  7. Create entity Stop. A bus route has many bus stops, while a stop can be shared by many routes. Therefore, there is a many-to-many relationship between Route and Stop. Place the mouse pointer over the Route entity. Drag out the Resource Catalog icon at top right.
    resource catalog
  8. Release the mouse button and select Many-to-Many Relationship -> Entity from Resource Catalog.
    select many to many in resource catelog
    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
  9. 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
  10. A route has multiple bus schedules. Create an entity Schedule from Route with a one-to-many relationship. Move the mouse pointer to Route. Press and drag out the Resource Catalog icon. Select One-to-Many Relationship -> Entity to create entity Schedule.
    create one to many entity
  11. Create the following columns in Schedule:
    Key Name Type
    PK id int(10)
    departure date
    arrive date
  12. 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
  13. 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: Draw Many to Many Relationship
  3. YouTube Video: Compare Logical and Physical Data Model Using Visual Diff
  4. 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. Data Flow Diagram with Examples - Food Ordering System
  4. Perform UML Modeling in NetBeans
  5. How to Organize Diagrams with Package?
    Tagged:
Tags of this article:

Comments (37)

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/
written by Rehana on February 18, 2015
I dnt know ERD.plz help me and tell me easy method
written by Rehana on February 18, 2015
plz help me draw a ERD and where it use it?plz tell me all information about ERD?
written by Leo Kudryavtsev on March 18, 2015
I am trying to display column user type in the document and cannot find the property name for it.
written by Leo Kudryavtsev on March 18, 2015
I am trying to display column user type in the document and cannot find the property name for it.
written by Ali Ahmadi on May 26, 2015
Which kind of Attribute is the date? PLZ Answer as soon as possible
Thanks
written by Angus Chan on May 28, 2015
You can use
date
String (store YYYY-MM-DD)
int
written by Brendo on March 22, 2016
Oi, senti falta do tipo "serial" do PostgreSQL.
written by Jick Yeung (VP) on March 24, 2016
Hi Brendo ,
You can create an int/bigint primary key column with native/identity id generator. This means an "auto increment int". It will be converted to serial when generating DDL.
written by Johannes on April 27, 2016
What is the RouteId doing in schedule? I also have that symbol in my diagram, but couldn‘t you just create the relation without that?

No comments:

Post a Comment