Use the Database Diagram to view a high-level, visual representation of an object and those objects which may be related to it. This helps you easily identify relationships between tables via foreign keys. You can use the Database Diagram to:
Understand the impact of changes.
Identify join predicates when writing complex queries for reports.
Understand the level of normalization of data when de-normalizing for performance or to save space.
Understand entity relationships so you can better use the data in applications or reports.
Relationships Displayed Automatically
The Database Diagram supports tables, views,
For most Business Intelligence and NoSQL connections, relationships must be defined manually.
To diagram a relationship
Select Tools | Diagram.
Drag tables, views, or synonyms from the Object Explorer to the Database Diagram window. This method is useful if you want to add objects without setting the relationship types to display or the reference levels.
Note: You can also right-click an object in the Object or Database Explorer and select Send To | Database Diagram.
Drag a column from one object to a column in a second object where you want to create a relationship.
Notes:
This feature does not add new objects to the diagram if a relationship exists; it only displays relationships between objects already in the diagram.
A line between objects indicates an existing relationship.
A indicates the referencing table, and a indicates the referenced table.
To reduce the number of columns that display in a large table, right-click the table and select Manage Hidden Columns. You can then hide any unnecessary columns to better understand the critical information.
You can use the Database Diagram tool to create relationships between two or more connections. The relationships you create are automatically saved and displayed the next time you diagram the same objects. Use the diagram, with the relationships you created, as a quick start when building cross-connection queries.
To diagram a cross-connection relationship
Switch to the second connection and add objects using the same procedure.
Note: A blue banner along the right side of the Database Diagram window indicates that you are in Cross-Connection Mode.
Use the following Database Diagram toolbar buttons to assist you in creating a database diagram.
Toolbar Button | Description |
---|---|
|
Click to reorganize the objects in the diagram to make the relationships more visible. |
Click to resize each table in the diagram to show all columns. | |
Select the depth of relationships you want the Database Diagram tool to use when it includes related objects in the diagram. Set to 0 to display only the selected object (the parent object). | |
Click to view the object details for the object selected in the diagram (opens in a new pane). | |
Click to open all tables and views for the current database, plus any referenced objects from other databases. To limit objects to the current database, select All Tables and Views from Current Database Only from the drop-down list. |
Tips:
When opening a previously saved Database Diagram file, you can right-click the Diagram pane and select Refresh to get the latest objects from the database, including added/removed columns and data type updates.
An * in the title of the object indicates that the saved version differs from the database version.
See also, Tutorial: Create a Database Diagram to Use as a Query Template.
Click here to view a video of this feature.
© ALL RIGHTS RESERVED. 使用条款 隐私 Cookie Preference Center