关系图窗格 (Visual Database Tools)Diagram Pane (Visual Database Tools)

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance 是Azure Synapse AnalyticsAzure Synapse AnalyticsyesAzure Synapse AnalyticsAzure Synapse Analytics 是并行数据仓库Parallel Data Warehouseyes并行数据仓库Parallel Data Warehouse适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 是Azure SQL 数据库Azure SQL DatabaseYesAzure SQL 数据库Azure SQL Database 是Azure SQL 托管实例Azure SQL Managed InstanceYesAzure SQL 托管实例Azure SQL Managed Instance 是Azure Synapse AnalyticsAzure Synapse AnalyticsyesAzure Synapse AnalyticsAzure Synapse Analytics 是并行数据仓库Parallel Data Warehouseyes并行数据仓库Parallel Data Warehouse

“关系图”窗格以图形形式显示了您通过数据连接选择的表或表值对象。The Diagram pane presents a graphic display of the tables or table-valued objects you have selected from the data connection. 同时也会显示它们之间的联接关系。It also shows any join relationships among them.

在“关系图”窗格中可以进行如下操作:In the Diagram pane you can:

  • 添加或移除表和表值对象并指定要输出的数据列。Add or remove tables and table-valued objects and specify data columns for output.

  • 创建或修改表和表值对象之间的联接。Create or modify joins between tables and table-valued objects.

当您在“关系图”窗格中进行更改时,“条件”窗格和 SQL 窗格会自动更新以反映所做的更改。When you make a change in the Diagram pane, the Criteria pane and SQL pane are updated to reflect your change. 例如,如果在“关系图”窗格内的表或表值对象窗口中选择某个要输出的列,查询和视图设计器会将该数据列添加到“条件”窗格中以及 SQL 窗格内的 SQL 语句中。For example, if you select a column for output in a table or table-valued object window in the Diagram pane, the Query and View Designer adds the data column to the Criteria pane and to the SQL statement in the SQL pane.

每个表或表值对象在“关系图”窗格中均作为单独的窗口出现。Each table or table-valued object appears as a separate window in the Diagram pane. 每个矩形的标题栏中的图标表示该矩形所代表的对象类型,如下表所示:The icon in the title bar of each rectangle indicates what type of object the rectangle represents, as illustrated in the following table.

选项Options

Tables
列出可以添加到“关系图”窗格中的表。Lists the tables you can add to the Diagram pane. 若要添加某个表,请选择该表,再单击“添加” 。To add a table, select it and click Add . 若要同时添加多个表,请选中这些表,再单击“添加” 。To add several tables at once, select them and click Add .

ViewsViews
列出可以添加到“关系图”窗格中的视图。Lists the views you can add to the Diagram pane. 若要添加某个视图,请选择该视图,再单击“添加” 。To add a view, select it and click Add . 若要同时添加多个视图,请选中这些视图,再单击“添加” 。To add several views at once, select them and click Add .

函数Functions
列出可以添加到“关系图”窗格中的用户定义的函数。Lists the user-defined functions you can add to the Diagram pane. 若要添加某个函数,请选择该函数,再单击“添加” 。To add a function, select it and click Add . 若要同时添加多个函数,请选中这些函数,再单击“添加” 。To add several functions at once, select them and click Add .

本地表Local Tables
列出由查询创建的表而不是数据库中的表。Lists tables created by queries rather than the ones that belong to the database.

同义词Synonyms
列出可以添加到“关系图”窗格中的同义词。Lists the synonyms you can add to the Diagram pane. 若要添加某个同义词,请选择该同义词,再单击“添加” 。To add a synonym, select it and click Add . 若要同时添加多个同义词,请选中这些同义词,再单击“添加” 。To add several synonyms at once, select them and click Add .

图标Icon 对象类型Object type
Table
查询或视图Query or View
被链接表Linked Table
用户定义函数User-Defined Function
链接视图Linked View

每个矩形显示表或表值对象的数据列。Each rectangle shows the data columns for the table or table-valued object. 显示于列名旁边的复选框和符号指示如何在查询中使用列。Check boxes and symbols appear next to the names of columns to indicate how the columns are used in the query. 工具提示显示列的数据类型和大小等信息。ToolTips display information such as data type and size for columns.

下表列出了各个表或表值对象的矩形中所使用的复选框和符号:The following table lists the check boxes and symbols used in the rectangle for each table or table-valued object.

复选框或符号Check box or symbol 说明Description






指定某个数据列是否出现在查询结果集内(“选择”查询),或者是否用于“更新”、“插入源”、“生成表”或“插入到”查询中。Specifies whether a data column appears in the query result set (Select query) or is used in an Update, Insert From, Make Table, or Insert Into query. 选择要添加到结果中的列。Select the column to add it to the results. 如果选择“(所有列)” ,则所有数据列都将出现在输出中。If (All Columns) is selected, all data columns appear in the output.

与复选框一起使用的图标会根据要创建的查询类型而更改。The icon used with the check box changes according to the type of query you are creating. 在创建“删除”查询时,不能选择单个列。When creating a Delete query, you cannot select individual columns.


表示数据列用于对查询结果进行排序(是 ORDER BY 子句的一部分)。Indicates that the data column is being used to order the query results (is part of an ORDER BY clause). 如果排序顺序为升序,则图标显示为 A-Z;如果排序顺序为降序,则图标显示为 Z-A。The icon appears as A-Z if the sort order is ascending or Z-A if sort order is descending.
表示数据列用于在聚合查询中创建分组结果集(是 GROUP BY 子句的一部分)。Indicates that the data column is being used to create a grouped result set (is part of a GROUP BY clause) in an aggregate query.
表示数据列包含在查询的搜索条件中(是 WHERE 或 HAVING 子句的一部分)。Indicates that the data column is included in a search condition for the query (is part of a WHERE or HAVING clause).
表示数据列的内容将进行汇总以便输出(包含在 SUM、AVG 或其他聚合函数中)。Indicates that the contents of the data column are being summarized for output (are included in a SUM, AVG, or other aggregate function).

备注

如果您对表或表值对象没有足够的访问权限,或者数据库驱动程序无法返回其有关信息,则查询和视图设计器将不显示该表或表值对象的数据列。Query and View Designer will not display data columns for a table or table-valued object if you do not have sufficient access rights to it or if the database driver cannot return information about it. 在这种情况下,查询和视图设计器将只显示表或表结构对象的标题栏。In such cases, the Query and View Designer displays only a title bar for the table or table-structured object.

“关系图”窗格上联接的表Joined Tables on the Diagram Pane

如果查询涉及联接,在联接所涉及的数据列之间将显示一条联接线。If the query involves a join, a join line appears between the data columns involved in the join. 如果没有显示联接的数据列(例如,表或表值对象窗口已最小化或者此联接涉及表达式),则查询和视图设计器会将联接线放在表示表或表值对象的矩形的标题栏中。If the joined data columns are not displayed (for example, the table or table-valued object window is minimized or the join involves an expression), the Query and View Designer places the join line in the title bar of the rectangle representing the table or table-valued object. 查询和视图设计器为每个联接条件显示一条联接线。The Query and View Designer displays one join line for each join condition.

联接线中间的图标形状指示表或表结构对象的联接方式。The shape of the icon in the middle of the join line indicates how the tables or table-structured objects are joined. 如果联接子句使用等于 (=) 以外的运算符,则该运算符将显示在联接线图标中。If the join clause uses an operator other than equal (=), the operator is displayed in the join line icon. 下表列出可在联接线中显示的图标:The following table lists the icons that can be displayed in a join line.

联接线图标Join line icon 说明Description
内部联接(使用等号创建)。Inner join (created using equal sign).
基于“大于”运算符的内部联接。Inner join based on the "greater than" operator. (在联接线图标中显示的运算符反映了在联接中使用的运算符。)(The operator displayed in the join line icon reflects the operator used in the join.)
外部联接,其中包括左侧表示的表中的所有行,即使它们在相关表中没有匹配行。Outer join in which all rows from the table represented on the left will be included, even if they do not have matches in the related table.
外部联接,其中包括右侧表示的表中的所有行,即使它们在相关表中没有匹配行。Outer join in which all rows from the table represented on the right will be included, even if they do not have matches in the related table.
完全外部联接,其中含有两个表中的所有行,即使它们在相关表中没有匹配行。A full outer join in which all rows from both tables will be included, even if they do not have matches in the related table.

联接线末端的图标表示联接的类型。Icons on the ends of the join line indicate the type of join. 下表列出联接的类型以及可在联接线末端显示的图标:The following table lists the types of joins and the icons that can be displayed on the ends of the join line.

联接线末端的图标Icon on ends of join line 说明Description
一对一联接One-to-one join
一对多联接One-to-many join
查询和视图设计器无法确定联接类型Query and View Designer cannot determine join type

另请参阅See Also

设计查询和视图操作指南主题 (Visual Database Tools)Design Queries and Views How-to Topics (Visual Database Tools)
“条件”窗格 (Visual Database Tools)Criteria Pane (Visual Database Tools)
对查询结果进行排序和分组 (Visual Database Tools)Sort and Group Query Results (Visual Database Tools)