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:
- 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.
- Click the “Import” button inside the Toolbox. An import window will appear.
- Select the Database Management System (DBMS) you use.
- Copy the provided query and paste it into your DBMS. Run the query.
- 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.”
- 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.
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.
To create an ERD manually:
- Open the Shape Library Manager and make sure the Entity Relationship library is turned on.
- Drag the desired entity object onto the canvas.
- 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.
- 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.
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.
- Select the line you would like to modify.
- 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.
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.
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.
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:
- Click on a shape. In the Advanced Shape Menu click “Export SQL.”
- 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:
- In the Entity Relationship shape library found in the Toolbox, click “Export.”
- 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.