Database Engineering
  • Need of Database
  • Database and Database Management System
  • What is Relational Database Model ?
  • Installing Postgresql
    • Installing PostgreSQL on Linux
    • Installing PostgreSQL on Windows
    • Installing PostgreSQL on Mac
    • Postgres in Docker
  • What happens during the initial installation ?
    • Roles, Users & Groups
    • More examples on Roles
  • Sample Databases
    • DVD Rental Database
  • Querying Data
    • SELECT Query
    • Column Aliases
    • Order By
    • SELECT DISTINCT
    • DB-TASK-001
  • Filtering Data
    • WHERE ?
    • AND Operator
    • OR Operator
    • LIMIT
    • FETCH
    • IN
    • BETWEEN
    • LIKE
    • SIMILAR TO
    • IS NULL
    • ESCAPE
    • DB-TASK-002
  • Entity Relationship Diagram
    • What is an ER Diagram ?
    • Entity
    • Identifiers
    • Relationship
    • Attributes
    • Cardinality
    • Entity Relationship Diagram Tutorial
    • DB-TASK-003
  • Joins
    • Joins
    • Joins With Employee and Departments
  • Joins on E-Commerce
Powered by GitBook
On this page
  1. Entity Relationship Diagram

Entity Relationship Diagram Tutorial

PreviousCardinalityNextDB-TASK-003

Last updated 5 months ago

Entity Relationship Diagram Tutorial Here are some best practice tips for constructing an ERD:

  1. Purpose and scope: Define the purpose and scope of what you’re analyzing or modeling. Add a description of your Subject Area. Document any assumptions and restrictions then you make. Show the level of detail necessary for your purpose. You might want to draw a conceptual, logical or physical model, depending on the detail needed. (See above for descriptions of those levels.)

  2. Entities: Identify the entities that are involved. Identify all of the entities you will use. An entity is a description of something that your system stores information about. This could be a customer, a manager, an invoice, a schedule, etc. Draw a rectangle (or your system’s choice of shape) for each entity you can think of on your page and labeling them as nouns. Keep them spaced out a bit.

  3. Relationships: Determine how the entities are all related. Look at two entities, are they related? If so draw a solid line connecting the two entities and label them. Some entities may not be related, and that’s fine. In different notation systems, the relationship could be labeled in a diamond, another rectangle or directly on top of the connecting line. How are the entities related? Write a brief description of how they are related. Each of your entities may not have any relationships, some may have multiple relationships. That is okay.

  4. Cardinality: Show whether 1-1, 1-many or many-to-many.

  5. Obligated (or participation): Show whether the relationship is mandatory or optional.

  6. Attributes: Layer in more detail by adding attributes of entities. Attributes are often shown as ovals. Any key attributes of entities should be added.

  7. Analyze and complete the diagram: Execute the tips for effective ER diagrams: a) Make sure the ER diagram supports all the data you need to store. b) Make sure all your entities and relationships and attribute are labeled on your diagram. c) Make sure that each entity only appears once per diagram. Eliminate any redundant entities. d) Examine relationships between entities closely. Are they necessary? Are there any relationships missing? Eliminate any redundant relationships. Don't connect relationships to each other. e) Use colors to highlight important portions of your diagram. f) You can transition relational tables and ER diagrams back and forth, if that helps you achieve your goal. g) If you’re troubleshooting a database problem, watch for holes in relationships or missing entities or attributes