ocp考试资料群:569933648 验证码:ocp OCP 12c 19c考试题库解析与资料群:钉钉群号:35277291
全部博文(487)
分类: Oracle
2019-10-14 10:24:31
Choose the best answer.
Exanine the desciption of the EMPLOYEES table:
Nane Null Type
----------------------------------------------------------
EMP_ID NOT NUL NUMBER
EMP_NAME VARCHAR2 (40)
DEPT_ID NUMBER(2)
SALARY NUMBER(8,2)
JOIN_DATE DATE
Which query is valid?
A) SELECT dept_id, join_date, SUM(salary) FROM employees GROUP BY dept_id,join_date;
B) SELECT depe_id,join_date, SUM(salary) FROM employees GROUP BY dept_id:
C) SELECT dept_id,MAX (AVG (salary)) FROM employees GROUP BY dept_id;
D) SELECT dept_ id,AVG (MAX (salary)) FROM employees GROUP BY dapt_id;
Anser:A
(解析:sum 函数如果遇到空值会跳过,不会造成最后的值为空。
其它的查询会出现错误:
SQL> select avg(max(sal)) from emp2 group by deptno;
AVG(MAX(SAL))
-------------
3616.66667
SQL> select deptno,avg(max(sal)) from emp2 group by deptno;
select deptno,avg(max(sal)) from emp2 group by deptno
*
第 1 行出现错误:
ORA-00937: 不是单组分组函数
)