正在加载图片...
10 Appendix C Other Relational Query Languages is that the graphical version of QBE uses a line linking attributes of two tables, instead of a shared variable,to specify a join condition. An interesting feature of QBE in Access is that links between tables are created automatically,on the basis of the attribute name.In the example in Figure C.2, the two tables account and depositor were added to the query.The attribute account number is shared between the two selected tables,and the system automatically inserts a link between the two tables.In other words,a natural-join condition is imposed by default between the tables;the link can be deleted if it is not desired. The link can also be specified to denote a natural outer join,instead of a natural join. Another minor difference in Access QBE is that it specifies attributes to be printed in a separate box,called the design grid,instead of using a P.in the table. It also specifies selections on attribute values in the design grid. Queries involving group by and aggregation can be created in Access as shown in Figure C.3.The query in the figure finds the name,street,and city of all customers who have more than one account at the bank.The"group by' attributes as well as the aggregate functions are noted in the design grid. Note that when a condition appears in a column of the design grid with the "Total"row set to an aggregate,the condition is applied on the aggregated value; for example,in Figure C.3,the selection">1"on the column account number is applied on the result of the aggregate"Count."Such selections correspond to selections in an SQL having clause. Selection conditions can be applied on columns of the design grid that are neither grouped by nor aggregated;such attributes must be marked as"Where" Eile Edit yiew Insert Query Iools Window Help 国·日题5小自89·,▣,?19Σ刚 customer depositor customer_name qu女omer_name customer_street account number customer_city L Field: customer_name customer_street customer_city account_numberv Table: customer customer customer depositor Total: Group By Group By Group By Count Sort: Show: ☑ ☑ Criteria: or: 〈回 Figure C.3 An aggregation query in Microsoft Access QBE.10 Appendix C Other Relational Query Languages is that the graphical version of QBE uses a line linking attributes of two tables, instead of a shared variable, to specify a join condition. An interesting feature of QBE in Access is that links between tables are created automatically, on the basis of the attribute name. In the example in Figure C.2, the two tables account and depositor were added to the query. The attribute account number is shared between the two selected tables, and the system automatically inserts a link between the two tables. In other words, a natural-join condition is imposed by default between the tables; the link can be deleted if it is not desired. The link can also be specified to denote a natural outer join, instead of a natural join. Another minor difference in Access QBE is that it specifies attributes to be printed in a separate box, called the design grid, instead of using a P. in the table. It also specifies selections on attribute values in the design grid. Queries involving group by and aggregation can be created in Access as shown in Figure C.3. The query in the figure finds the name, street, and city of all customers who have more than one account at the bank. The “group by” attributes as well as the aggregate functions are noted in the design grid. Note that when a condition appears in a column of the design grid with the “Total” row set to an aggregate, the condition is applied on the aggregated value; for example, in Figure C.3, the selection “> 1” on the column account number is applied on the result of the aggregate “Count.” Such selections correspond to selections in an SQL having clause. Selection conditions can be applied on columns of the design grid that are neither grouped by nor aggregated; such attributes must be marked as “Where” Figure C.3 An aggregation query in Microsoft Access QBE
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有