23.choose the best answer

View the Exhibits and examine PRODUCTS and SALES tables.

You issue the following query to display product name and the number of times the

product has been sold:

SQL>SELECT p.prod_name, i.item_cnt

FROM (SELECT prod id, COUNT(*) item_cnt

FROM sales GROUP BY prod_id) i RIGHT OUTER JOIN products p

ON i.prod_id = p.prod_id;

What happens when the above statement is executed?

A) The statement executes successfully and produces the required output.

B) The statement produces an error because a subquery in the FROM clause and outer-joins cannot be used together.

C) The statement produces an error because ITEM_CNT cannot be displayed in the outer query.

D) The statement produces an error because the GROUP BY clause cannot be used in a subquery in the FROM clause.

Answer:A

(SQL> select d.dname,e.emp_cnt

from (select deptno,count(*) emp_cnt from emp group by deptno)e right outer join dept d

on e.deptno=d.deptno;

DNAME EMP_CNT

-------------- ----------

ACCOUNTING 2

RESEARCH 4

SALES 6

OPERATIONS

TRAIN)

【OCP-12c】CUUG 071题库考试原题及答案解析(23)的更多相关文章

  1. 【OCP认证12c题库】CUUG 071题库考试原题及答案(28)

    28.choose the best answer Evaluate the following SQL statement: SQL> SELECT promo_id, promo_categ ...

  2. 【OCP认证12c题库】CUUG 071题库考试原题及答案(27)

    27.choose two The SQL statements executed in a user session are as follows: SQL> CREATE TABLE pro ...

  3. 【OCP认证12c题库】CUUG 071题库考试原题及答案(26)

    26.choose two Examine the structure of the PRODUCTS table. Which two statements are true? A) EXPIRY_ ...

  4. 【OCP认证12c题库】CUUG 071题库考试原题及答案(25)

    25. choose the best answer Evaluate the following SQL statement: ALTER TABLE hr.emp SET UNUSED (mgr_ ...

  5. 【OCP-12c】CUUG 071题库考试原题及答案解析(24)

    24. choose the best answer In the EMPLOYEES table there are 1000 rows and employees are working in t ...

  6. 【OCP-12c】CUUG 071题库考试原题及答案解析(22)

    5.choose the best answer Evaluate the following CREATE SEQUENCE statement: CREATE SEQUENCE seq1 STAR ...

  7. 【OCP-12c】CUUG 071题库考试原题及答案解析(21)

    3.choose three View the Exhibit and examine the description of SALES and PROMOTIONS tables. You want ...

  8. 【OCP-12c】CUUG 071题库考试原题及答案解析(20)

    20.choose two Examine the description of the EMP_DETAILS table given below: Which two statements are ...

  9. 【OCP-12c】CUUG 071题库考试原题及答案解析(19)

    1.choose the best answerWhat is the primary difference between the relational database (RDB) andobje ...

随机推荐

  1. DB2 日期时间函数

    db2日期时间函数 (DATE(TRIM(CHAR(DT#11Y))||'-'||TRIM(CHAR(DT#11M))||'-'||TRIM(CHAR(DT#11D))) BETWEEN DATE(' ...

  2. 服务级别协议(SLA)与运行水平协议(OLA)

    服务级别协议(SLA)与运行水平协议(OLA): 服务级别管理和服务级别协议在国内已被广泛接受并成用.本文试图讨论服务级别协议(SLA)和运行水平协议(OLA)的异同. 1. SLA a.定义 服务级 ...

  3. 1-vim的复制粘贴

    一. http://blog.csdn.net/hk2291976/article/details/42196559 二. "+y"+p---------------------- ...

  4. innodb count优化测试

    对于索引优化真的是门课题,先来研究下最平常的问题,innodb引擎下 怎么让count(*)快一点. 首先需要清楚 innodb 默认是对主键建立聚簇索引,如果没有主键,那就是对具有唯一且非空值的索引 ...

  5. Sprint boot notes

    1. spring.io 官网 2. http://javainuse.com/spring/sprboot spring boot学习资源 3. spring boot websocketss视频  ...

  6. __slots__(面向对象进阶)

    1.__slots__是什么:是一个类变量,变量值可以是列表,元祖,或者可迭代对象,也可以是一个字符串(意味着所有实例只有一个数据属性) 2.引子:使用点来访问属性本质就是在访问类或者对象的__dic ...

  7. Chrome Console API 参考

    https://developers.google.com/web/tools/chrome-devtools/console/command-line-reference

  8. LCD相关基础知识

    1.什么是LCD? (1)LCD(Liquid Crystal Display)俗称液晶.液晶是一种材料,液晶这种材料具有一种特点:可以在电信号的驱动下液晶分子进行旋转,旋转时会影响透光性, 因此我们 ...

  9. git fatal:HttpRequestException encountered

    网上查了一下发现是Github 禁用了TLS v1.0 and v1.1,必须更新Windows的git凭证管理器,才行. https://github.com/Microsoft/Git-Crede ...

  10. UVALive - 6434 —(思维题)

    题意:给出了你由n个数组成的序列,让你将这个序列分为成m个集合,使得每一个集合的最大值减最小值的差相加最小.(如果某集合只有一个数字,则最大值减最小值为0) . 思路:首先我们不难想到,最优的分配方法 ...