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.
In Lucidchart, you can either generate an ERD automatically based on imported data or create one manually or from a template. To create one from scratch, you will need to first enable the ERD shape library from the shape manager.
When working with ERD shapes, an advanced shape bar will appear at the top of your canvas with special settings that allow you to edit your diagram.
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 your database components, follow these steps:
- 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.
- Use the provided query to generate shapes of the individual tables in your database.
- Import your .CSV, .TSV, or .TXT 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 “Import.”
- 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.
- Click in the ERD shape library. Alternatively, navigate to File > Import Data > Salesforce > Schema Import OR File > Import Data > Entity Relationship > Salesforce Import.
- In the dialog that pops up, click .
- The next window will prompt you to sign in to Salesforce. Click "Continue."
- If you have not linked to Salesforce before, the next window will prompt you to grant Lucidchart permission to access to your Salesforce account. Click "Allow" to do so. You can revoke access at any time in your personal settings. Note: 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.
- 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.
- Beneath “Import Options,” select between “Show only relationships” or “Show all object details.” Click .
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.
- 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.
Export your ERD to the DBMS of your choice (with the exception of connections between tables).
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 menu. The text field below will produce the correct statement for the entire page.
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. 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.
Design, plan, and understand relational databases with Entity Relationship Diagrams (ERDs) in Lucidchart!
ERDs allow you to visualize the relationships between your databases so you can better understand your data’s organization and functions. Our data import feature allows you to pull your data directly from Database Management Systems such as MySQL, Oracle, PostgreSQL, SQLServer, and even Salesforce. Alternatively, you can use our ERD shape library to manually build your ERD from scratch directly in Lucidchart.
This section describes how you can manually build an ERD to understand the relationships between six school databases:
- Subject Teachers
Each database contains information that relates to information in another database, but to avoid confusion, the data is organized into separate databases. However, there are instances where it could be useful to understand the relationships between the data. For example, you might want to see which students in one “group” have a specific teacher for their math class. You know this information is available somewhere in your databases, but without ERDs, it can be difficult to understand where this data is actually stored and how to find it quickly. ERDs set you up for success because they allow you to visualize and, in turn, better understand how your databases relate to each other.
For this example you would create an ERD like this:
Here, you can find one entity shape for each database (“Marks,” “Students,” “Groups,” “Subjects,” “Subject Teacher,” and “Teachers”). Beneath each entity, you find various attributes, or additional information, that are directly related to the parent entity. These attributes correspond to columns in a database, while entities correspond to rows. Notice how each student has basic attributes such as a unique student ID, a first name, and a last name. Each student is also a part of a group, which is why you see a “GroupID” attribute under the “Students” entity. The same is true for the “Teachers” entity; each teacher has a unique ID (“TeacherID”), a first name, and a last name. These entity shapes give you a basic outline of the information you can expect to find in each respective database without the need to open databases individually.
You probably also noticed the lines that connect the entities to one another. These line connections represent the relationships between databases, or entities. Each line connection also contains different symbols to reflect the type of relationship between the entities.
Use this guide to understand the cardinality each symbol represents:
By connecting your entity shapes with these lines, you create a simple visualization that specifically explains how databases relate to one another.
Take a look at the “Groups” entity in the ERD shown above, for example. You can see that although the “Groups” entity only contains two attributes (“GroupID” and “Name”), there are two lines which connect to the entity: one from the “Students” entity and one from the “SubjectTeacher” entity.
You can see that both the “Students” and “SubjectTeacher” entities contain an attribute called “GroupID,” and the lines that connect from the “GroupID” attributes within each entity show a direct relationship to the “Groups” entity. In other words, the lines show that the “GroupID” attributes in the “Students” and “SubjectTeacher” entities are the same as the “GroupID” attribute in the “Groups” entity.
Additionally, you can reference the cardinality guide shown above to determine a few important details about the relationships between these entities.
For example, this ERD shows:
- Each group has at least one student, but could have more students, as shown by the line connection.
- Each student can be a part of zero to many groups, as shown by the line connection.
- Each subject teacher has one group, as shown by the line connection.
- Each group has many subject teachers, as shown by the line connection.
As you can see, ERDs empower you to understand key features about your databases through easy visualizations, and you don’t even have to worry if something changes. Lucidchart allows you to change the line connection format in a few steps. For more complex database structures, you can even add colors and line styling to make your ERD easier to navigate. When you’re done, don’t forget to export your ERD to your favorite DBMS or share your document with collaborators.
Try it today, and see for yourself how ERDs can improve your workflow and database organization! Click here to start from the blank template used in this example, or browse additional ERD templates here.