Create an Entity Relationship Diagram in Lucidchart

Written by:  Morgan T
Last updated:  

Create Entity Relationship diagrams (ERDs) with customized text, styling, and relationships between fields. Automatically generate database tables and schemas using our SQL import feature.

Plan availability: Free, Individual, Team, and Enterprise.

Watch: Entity relationship diagram

ERD overview

An Entity Relationship diagram (ERD) is a visual representation of a database that shows how the elements within are related. An ER diagram is made up of two object types—entities and relationships. An entity in this context is a component of data from the dataset, shown as a shape on the canvas. The relationships between entities are represented as lines that have special line endings called cardinalities, which describe how two elements of the database interact with each other.

Import a database

The ERD import feature uploads all of your database tables and schemas directly to your shape menu. You can import updated database files at any time, and the fields will be updated in the shape menu and on the canvas.

To import your database components, follow these steps:

  1. Open the Shape Library Manager by clicking More shapes at the bottom of the shape menu.
  2. Search for the “Entity Relationship” shape library.
  3. Click the checkbox next to “Entity Relationship”.
  4. Select Use selected shapes.
  5. Click Import from the Entity Relationship shape library.
  6. In the import menu, select the Database Management System (DBMS) you use.

     
  7. Click Copy to Clipboard to copy the query.
     
  8. Paste and run the query on your database.
  9. Select Next.
  10. Click Choose File to Import your .CSV, .TSV, or .TXT file. 
    • Alternatively, copy and paste the query results in the open text area.
       
  11. Click Import.   

Lucidchart immediately converts the imported query into a list of databases, tables, and schemas and organizes the list in your shape menu. Each collapsible section of the shape menu represents a database. The names inside a section correspond with database tables. An additional subsection would indicate a schema.

You can then drag the database tables from the shape menu onto the canvas. If you have properly set up the primary and foreign keys, when you drag related tables onto the canvas, Lucidchart draws relationship lines automatically.

Import a Salesforce schema  enterprise-tag.png

With the Schema Import from Salesforce, admins can map out the architecture of their Salesforce instances.

Note: This feature is available only on Enterprise accounts and is not available to users in the FedRAMP environment. 

To import your schema, follow these steps:

  1. Open the Shape Library Manager by clicking More shapes at the bottom of the shape menu.
  2. Search for the “Entity Relationship” shape library.
  3. Click the checkbox next to “Entity Relationship”.
  4. Select Use selected shapes.
  5. Click Salesforce Import in the Entity Relationship shape library.
     
  6. In the dialog that pops up, click Import from Salesforce.
  7. The next window will prompt you to sign in to Salesforce. Click Continue.
  8. If you have not linked to Salesforce before, the next window will prompt you to grant Lucidchart permission to access your Salesforce account. Click Allow.
    • You can revoke access at any time in your Lucid account settings. 
    • If you encounter an error message after this step, please check your login IP Ranges under your Salesforce user profile and make sure that those ranges are not restricted. 
  9. In the next window, select which Salesforce objects you would like to import into Lucidchart.
    • Search for specific objects using the search bar at the top. If no objects are found, you will be prompted to adjust your search term.
  10. Select between “Show only relationships” or “Show all object details.”
  11. Click Import.

Manually create or edit an ERD

You can create an ERD manually using the Entity Relationship shape library. You can do this by dragging out shapes from the shape library and adding relationships, text, and styling.

Tip: Save time by creating an ERD with AI. Learn more in our Boost productivity with Lucid AI in Lucidchart article.

Add or remove fields

To add or remove fields, select the shape or click the Context Panel icon in the upper-right corner of the canvas to open the Entity Contextual Panel. In Advanced Options drop-down, indicate the number of fields needed.

Add text

Double-click on the text to enter text edit mode. 

Once you have selected a text box, you can press:

  • Tab on your keyboard to move to the next row.
  • Shift+Tab to go to the previous row.
  • Enter or click off the object to exit.

Adjust entity size

To change the size of an object, click and drag from one of the corners and extend to either side. As you move an object, the columns will auto-adjust to fit the content inside.

Add lines

Create a relationship line between two entities by clicking and dragging from any dot on an object. You can drag the line to another shape and create a relationship to a specific field.

You can also drag and release the cursor over the canvas to auto-prompt adding a new entity object.

Note: If you decide to add or remove fields after you have created a relationship, any connected lines will move with the fields they are attached to. There is no need to redraw them.

Collapse or expand an entity

To collapse or expand an entity to clean up or simplify your diagram, follow these steps:

  1. Select the entity you want to collapse or expand.
    • You can’t collapse or expand more than one entity at a time.
  2. Click the arrow icon that appears near the top-right corner of the entity.

You can also collapse or expand an entity from the Contextual Panel that appears on the right side of the canvas when an entity is selected. To do so, click Collapse table or Expand table under “advanced options” in the “Layout” tab.

Format lines

To add formatting to the lines of your ERD, select the line and use the drop-down menu in the properties bar to assign new cardinalities to each of the line's endpoints. The default line for an ERD is the starting point of the screen recording below.

Explanation of ERD cardinalities

Cardinalities represent the relationships between databases, or entities. Each line connection contains different symbols to reflect the type of relationship between the entities.

Use this guide to understand the cardinality each symbol represents:

erd-cardinality-guide.png

Add style

You can use the advanced shape bar to adjust the shading of your entity objects. Here are your options for doing so:

  • Add shading to alternate rows of a table or to the table header using "Advanced Options" in the Context Panel.
     
  • Change the color of the shading of the header or alternate rows.

Use the formatting bar across the top of the canvas to style entity objects while they are selected. You can:
 

Tip: Enhance your ERD by color-coding and adding a key. Read our Add a diagram key in Lucidchart article for more information.

Update an ERD

To import an updated database file to an existing ERD, follow these steps:

  1. Select Import in the Entity Relationship shape library located on the left-hand side of the page. 
  2. In the pop up that appears, select one of the following options:
    • No, toolbox only to update only the data in the toolbox.
    • Yes to update both the toolbox and the existing shapes on the document.

Export an ERD

Export your ERD to the DBMS of your choice (with the exception of connections between tables).

To export your entire page, follow these steps:

  1. In the Entity Relationship shape library, click Export.
     
  2. An "Export to SQL" dialog box will appear. Choose a DBMS from the menu. 
  3. Click Copy to Clipboard to copy the correct statement for the entire page.
     
  4. Click Done.

FAQ

Why are the relationships between the shapes of my diagram not showing up?

When Lucidchart is not drawing lines between the entities of your imported ERD, it is likely that your data file does not indicate the relationships using primary and foreign keys. To check this, please open your data file and make sure that the cells at the end of each row are populated with information about the relationships between entities.

Are there any limitations on exporting my ERD?

If you are exporting your ERD to Quickbase, there is a maximum limit of 80 tables and 50 connections. Otherwise, if you are exporting in another format, there are no hard limits.

Resources

To learn more about this feature, explore the additional resources below. These resources are available in English only.

Community post

Represent the relationships between your databases by building an ERD!

Templates
Database ER diagram (crow’s foot)

DBMS ER diagram (UML notation)

Videos

Entity Relationship Diagram (ERD) Tutorial - Part 1

Entity Relationship Diagram (ERD) Tutorial - Part 2

Give feedback on this article

Have feedback about this article? Tell us about your experience here

Did you find what you were looking for?

Still have a question or want to share what you have learned? Visit our Community   to get help and collaborate with others.