OCP-1Z0-051-2015-40题

Which two are true about aggregate functions? (Choose two.)

A. You can use aggregate functions in any clause of a SELECT statement.
B. You can use aggregate functions only in the column list of the select clause and in the WHERE  clause of a SELECT statement.
C. You can mix single row columns with aggregate functions in the column list of a SELECT statement by grouping on the single row columns.
D. You can pass column names, expressions, constants, or functions as parameter to an aggregate function.
E. You can use aggregate functions on a table, only by grouping the whole table as one single group.
F. You cannot group the rows of a table by more than one column while using aggregate  functions.
Answer: A,D
Explanation:

聚合函数定义

Aggregate functions return a single result row based on groups of rows, rather than on single rows. 

Aggregate functions can appear in select lists and in ORDER BY and HAVING clauses. 聚合函数可以使用orderby 和 having 的子句中使用。

They are commonly used with the GROUP BY clause in a SELECT statement, where Oracle Database divides the rows of a queried table or view into groups.

 In a query containing a GROUP BY clause, the elements of the select list can be aggregate functions, GROUP BY expressions, constants, or expressions involving one of these. 

Oracle applies the aggregate functions to each group of rows and returns a single result row for each group.

--聚合函数根据group的情况,返回每个groups里的一个result。 

If you omit the GROUP BY clause, then Oracle applies aggregate functions in the select list to all the rows in the queried table or view. You use aggregate functions in the HAVING clause to eliminate groups from the output based on the results of the aggregate functions, rather than on the values of the individual rows of the queried table or view.

-如果省略group by 子句,那么聚合函数针对查询表或视图的所有记录生效。

Many (but notall) aggregate functions that take a single argument accept these clauses:

一些聚合函数可以在子句中带一个参数

-聚合函数可以嵌套使用

All aggregate functions except COUNT(*), GROUPING,and GROUPING_ID ignore nulls. You can use the NVL functionin the argument to an aggregate function to substitute a value for a null. --除了count(*),grouping,和grouping_id外,所有的聚合函数都会忽略nulls。 当我们遇到Null 时,可以在聚合函数中使用NVL 函数来处理null。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值