Create a database diagram

You can create a database diagram to visualize your database structure, add and configure objects, define relationships between them, and adjust the diagram layout.

To create a database diagram:

1. Open a diagram in one of the following ways:

  • Select File > New > Database Diagram.

  • Select Database > Database Diagram.

  • On the Start Page, select Database Design > New Database Diagram.

Tip

To open a diagram containing a specific object, in Database Explorer, right-click the object and select Send to > Database Diagram.

2. Add database objects to the diagram:

  • To add an existing object, drag the object from Database Explorer to the diagram.

  • To add a new object:

    1. On the Database Diagram toolbar, select the object type you want to add. Alternatively, right-click the diagram and select New, then select the object type.

    Object type icons on the Database Diagram toolbar and the shortcut menu with the expanded list of object types

    2. In the editor, specify the object properties.

    The table object editor with object details specified and the Apply button highlighted

Note

The properties you need to specify depend on the object type. For more information about editing objects, see:

  • Table Designer
  • View Designer
  • Procedure Designer
  • Function Designer

For more information, see Add database objects to a diagram.

3. Add physical relationships (foreign key constraints) or virtual relationships between tables:

  • To add a physical relationship, on the Database Diagram toolbar, click Relation icon for creating a physical relationship, then configure the properties.

  • To add a virtual relationship, on the Database Diagram toolbar, click Virtual Relation icon for creating a virtual relationship, then configure the properties.

New Virtual Relation Properties dialog with new relationship configured

For more information, see Work with relationships.

4. Arrange shapes on a diagram:

  • To arrange objects automatically, on the Database Diagram toolbar, click Layout Diagram icon on the Database Diagram toolbar.

Layout Diagram icon on the Database Diagram toolbar

  • To arrange objects manually, drag shapes and move the relationships.

For more information, see Diagram shapes and layout.

5. Optional: Add other elements, such as notes, containers, images, or a stamp, to the diagram.

Database diagram with a stamp showing company, project, version, date, and author details

For more information, see Additional elements on a diagram.

6. Save the diagram in one of these ways:

  • On the toolbar, click Save icon on the toolbar.

  • Right-click the diagram tab and save the diagram as a .dbd file.

Saving a database diagram from the diagram tab context menu