Entity Relationship Diagrams

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

Watch this video to learn more about ERDs, then read the tutorial below to learn how to make one in Lucidchart.

The ERD import feature uploads all of your database tables and schemas directly to your Toolbox. When you drag related tables onto the canvas, Lucidchart draws relationship lines automatically. You can import updated database files at any time, and the fields will be updated in the Toolbox and on the canvas.

To import an ERD:

  1. Open the Shape Library Manager by clicking “+ Shapes” in the Toolbox or by hitting the “M” key on your keyboard. Make sure the Entity Relationship library is turned on.

    Lucidchart ERDs open shape manager
  2. Click the “Import” button inside the Toolbox. An import window will appear.

    Lucidchart ERDs import
  3. Select the Database Management System (DBMS) you use.
  4. Copy the provided query and paste it into your DBMS. Run the query.
  5. Export the results from your DBMS as a TSV or CSV file and upload it by clicking the “Choose File” button in the import window. Alternatively, copy and paste the query results in the open text area. Click “Ok.”
  6. Lucidchart immediately converts the imported query into a list of databases, tables, and schemas and organizes the list in your Toolbox. Each collapsible section of the Toolbox represents a database. The names inside a section correspond with database tables. An additional subsection would indicate a schema.

    Lucidchart_ERDs_import_your_file.png

In the example below, a TSV file containing multiple databases was imported. When “shard_servers” and “Shards” were both dragged to the canvas, the relationship was automatically drawn.

Lucidchart ERD import example

To create an ERD manually:

  1. Open the Shape Library Manager and make sure the Entity Relationship library is turned on.
  2. Drag the desired entity object onto the canvas.
  3. Double-click on the text to enter text edit mode. Once you have selected a text box, you can easily move between text boxes by pressing Tab on your keyboard to go forward or Shift+Tab to go backward. Press Enter or click off the object when finished.
  4. To change the size of an object, simply 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.

    Lucidchart ERDs open shape manager

    Lucidchard ERDs import

When you click on a table, the Advanced Shape Menu will drop down from the top of the editor. Use the Advanced Shape Menu to change the number of fields in a table.

Lucidchart ERDs add or remove fields

  1. Select the line you would like to modify.
  2. Use the drop-down menu in the properties bar to select the cardinality or other formatting option of each of the line's endpoints. The default line for an ERD is pictured below.

    Lucidchart ERDs format lines

You can use the property bar to easily style entity objects while they are selected.

    • Modify text formatting, size, color, font, and alignment.
    • Adjust line thickness and color.
    • Select a fill color, gradient, or image.

Add shading to alternate rows of a table or to the table header using the Advanced Shape Menu.

Lucidchart ERDs add style to your ERD

You can create a relationship line 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 OR release the cursor over empty canvas to auto-prompt adding a new entity object.

If you decide to add or subtract 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.



Lucidchart ERDs create relationships between objects

Lucidchart ERDs create relationships between objects

Export your ERD to the DBMS of your choice. You can choose to export individual tables or the entire page (with the exception of connections between tables).

To export a single table:

  1. Click on a shape. In the Advanced Shape Menu click “Export SQL.”
  2. A dialog will appear. Choose your DBMS from the drop-down menu on the right. The text field below will produce the correct create statement.

To export your entire page:

  1. In the Entity Relationship shape library found in the Toolbox, click “Export.”
  2. A dialog will appear. Choose your DBMS from the drop-down menu on the right. The text field below will produce the correct create statement for the entire page.

    Entity Relationship Diagram

    Entity Relationship Diagram

    Entity Relationship Diagram

    Entity Relationship Diagram