How do you create a database diagram?

Database diagrams graphically show the structure of the database and relations between database objects. You can generate a diagram for a data source, a schema, or a table. To create relations between database objects, consider using primary and foreign keys.

The following video gives a short overview of diagrams in DataGrip.

You can save the generated diagrams in two formats: UML and PNG. The UML format is an internal format developed specifically for DataGrip. It is not supported by other products. If you want to share the created diagram, consider using PNG.

Also, you can build execution plans. Execution plan is a set of steps that were used to access data in a database. DataGrip supports two types of execution plans:

  • Explain Plan: the result is shown in a mixed tree and table format on a dedicated Plan tab. You can click the Show Visualization icon (

    How do you create a database diagram?
    ) to create a diagram that visualizes the query execution.

  • Explain Plan (Raw): the result is shown in a table format.

Generate a diagram for a database object

  • In the Database Explorer (), right-click a database object and select .

How do you create a database diagram?

Build a query plan

  1. Right-click an SQL statement, and select Explain Plan.

  2. By default, you see the tree representation of the query in the Plan pane. To see the query plan, click Show Visualization , or press Ctrl+Alt+Shift+U.

Enable column comments

  1. Generate a diagram. For more information about generating a diagram, see Generate a diagram for a database object.

  2. Click the Comments button ().

    How do you create a database diagram?

Apply colors to diagram objects

  1. In the Database Explorer (), right-click an object and select .

  2. Select a color and click OK.

    How do you create a database diagram?

Save diagrams in the UML format

This UML format is an internal format supported only by DataGrip.

  • Right-click a diagram and navigate to .

    To open the saved diagram, drag the UML file to the editor.

Save diagrams in the PNG format

  • Right-click a diagram and select .

Analyze graph

The Analyze Graph action group lets you analyze the graph in various ways such as perform auto clusterization, measure the node centrality, search cycles, filter path between two nodes, and so on.

Filter paths between two nodes

Most of the time, generated diagrams are big and complicated. Typically, you want to concentrate only on the specific part of the diagram. DataGrip lets you filter paths between two diagram elements.

  1. In the diagram editor, select two nodes on which you want to focus and right-click one of them to open the context menu.

  2. From the context menu, select Analyze Graph | Focus on Paths between Two Nodes.

  3. In the dialog that opens, select additional options if needed and click Find.

    How do you create a database diagram?

    DataGrip displays connections associated only with the selected nodes.

Measure diagram centrality

You can use this action to identify the important nodes in the graph.

  1. In the diagram editor, right-click anywhere in the editor to open the context menu.

  2. From the context menu, select Analyze Graph | Measure Centrality.

  3. In the dialog that opens, select additional options if needed and click Measure.

    How do you create a database diagram?

    The node "importance" is expressed via fractional value from 0.0 to 1.0 measurement and the brightest node selection should be explored first.

    How do you create a database diagram?

Diagram configuration settings

To configure the default visibility settings and layout for diagrams, open settings by pressing Ctrl+Alt+S and navigate to .

How do you create a database diagram?
  1. Open settings by pressing Ctrl+Alt+S and navigate to .

  2. Click Edges//Generalization edge.

  3. Click the color picker near the Foreground checkbox.

    How do you create a database diagram?

Content pane

Select the checkboxes next to the elements to be shown on diagrams.

Item

Description

Show Difference

Details

If this checkbox is selected, all the specified details of the elements will be shown in the UML class diagram for a revision. If this checkbox is not selected, only node elements will be included in the diagram.

Database Schema Diagram

Key columns

For the primary key columns to be shown when a diagram opens, select this checkbox.

When viewing a diagram in the editor, use on the toolbar to show or hide the corresponding columns.

Columns

For the columns other than the primary key columns to be shown when a diagram opens, select this checkbox.

When viewing a diagram in the editor, use on the toolbar to show or hide the corresponding columns.

Graphical Explain Plan

Attributes

Toggles the display of query attributes on a query map. These attributes can be a number of rows, index names, or any other additional information about the query.

How do you create a database diagram?

Controls

Item

Description

Default layout

Select the desired layout from the Default layout list. Node elements in newly created diagrams will be arranged according to the selected layout.

Default scope

Select scope from the Default scope list. Specifying a scope helps you avoid showing in diagram the unnecessary hierarchies. You can define scopes for your project in the Scopes page of the Settings Preferences dialog.

Fit content after layout

If this checkbox is selected, then after applying a layout selected on the diagram context menu, all diagram elements will be resized to fit into the current diagram area. In diagram, use the toolbar button.

Do relayout when new elements were added

If this checkbox is selected, diagram layout will be performed automatically after adding new elements.

Last modified: 07 June 2022

Where can I create a database diagram?

Dbdiagram ERD..
Diagrams.net ERD..
Lucidchart ERD example..
QuickDBD ERD example..
ERD Plus database diagram designer..
Cacoo is a free ER Diagram tool..
Built as a whiteboard tool, Miro can be used as a database design tool..
Giffy is a web-based ERD tool..

What is database with diagram?

Database diagrams graphically show the structure of the database and relations between database objects. You can generate a diagram for a data source, a schema, or a table. To create relations between database objects, consider using primary and foreign keys.

How can I create a database?

Create a blank database.
On the File tab, click New, and then click Blank Database..
Type a file name in the File Name box. ... .
Click Create. ... .
Begin typing to add data, or you can paste data from another source, as described in the section Copy data from another source into an Access table..

How do I create a database diagram from an existing database in SQL Server?

Open SQL Server Management Studio (SSMS). In the Object Explorer on the left, expand your database. Right-click on Database Diagrams, and then select New Database Diagram.