9、(5-5) choose the best answer
View the Exhibit and examine the structure of the SALES and STORES tables.
You want to display the store name and the total quantity sold for each item in the store.

Which SQL statement will give the required output?
A) SELECT str.name, s1.items_id, SUM(s1.quantity)
FROM sales s1 JOIN stores str
ON (s1.store_id = str.store_id)
GROUP BY str.name, s1.items_id, s1.quantity;

B) SELECT str.name, s1.items_id, SUM(s1.quantity)
FROM sales s1 JOIN stores str
ON (s1.store_id = str.store_id)
GROUP BY str.name, s1.items_id;

C) SELECT str.name, s1.items_id,
(SELECT SUM(quantitY)
FROM sales sls
ON sls.store_id = s1.store_id
GROUP BY sls.store_id)
FROM sales s1 JOIN stores str
ON (s1.store_id = str.store_id);

D) SELECT str.name, s1.items_id, SUM(s1.quantity)
FROM sales s1 JOIN stores str ON (s1.store id = str.store_id)
GROUP BY s1.items_id, s1.quantity;

Answer:B
(解析:分组函数的最基本特点,没有出现在分组函数中的列必须要出现在 group by 子句中。)

【OCP-12c】CUUG最新考试原题整理及答案(071-9)的更多相关文章

  1. 【OCP-12c】CUUG最新考试原题整理及答案(071-11)

    11.(5-8) choose the best answer: Examine the structure of the BOOKS_TRANSACTIONS table. You want to ...

  2. 【OCP-12c】CUUG最新考试原题整理及答案(071-12)

    12.(5-12)choose two:Examine the data in the CUSTOMERS table:You want to list all cities that have mo ...

  3. 【OCP-12c】CUUG最新考试原题整理及答案(071-10)

    10.(5-6) choose the best answer:Examine the structure of the EMPLOYEES table:There is a parent/child ...

  4. OCP 12c最新考试原题及答案(071-8)

    8.(5-4) choose the best answer:You need to produce a report where each customer's credit limit has b ...

  5. OCP 12c最新考试原题及答案(071-7)

    7.(5-1) choose two:View the Exhibit and examine the structure of the PRODUCTS table.Which two tasks ...

  6. OCP 12c最新考试原题及答案(071-6)

    6.(4-21) choose the best answer: View the Exhibit and examine the structure of the CUSTOMERS table. ...

  7. OCP 12c最新考试原题及答案(071-5)

    5.(4-12) choose two: You executed the following CREATE TABLE statement that resulted in an error: SQ ...

  8. OCP 12c最新考试原题及答案(071-4)

    4.(4-11) choose two:View the Exhibit and examine the data in the PRODUCT_INFORMATION table.Which two ...

  9. OCP 12c最新考试原题及答案(071-3)

    3.(4-10) choose the best answer:The user SCOTT who is the owner of ORDERS and ORDER_ITEMS tables iss ...

随机推荐

  1. onload函数和自执行函数的区别(jquery API网址:http://jquery.cuishifeng.cn/)

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  2. 高性能Web服务器Nginx的配置与部署研究(11)应用模块之Memcached模块的两大应用场景

    一.应用场景1 最近在一个项目中,用到了Nginx的Memcached模块,所以就在这个系列教程中提前把Memcached模块拿出来写了.另外发现最近我的 博客文章频频被很多用采集器的网站拿走,帮我发 ...

  3. UNITY的UI之Pivot与Anchor区别

    Pivot Rotations, size, and scale modifications occur around the pivot so the position of the pivot a ...

  4. 校准liunx时间简单好用的命令

    查看时间服务器的时间# rdate time-b.nist.gov 设置时间和时间服务器同步# rdate -s time-b.nist.gov 查看硬件时间 # hwclock 将系统时间写入硬件时 ...

  5. Qt + OpenSenceGraph(osg) 加载OSG模型

  6. 53-C++ CH08 01

     http://lx.lanqiao.cn/problem.page?gpid=T407 算法训练 C++ CH08 01   时间限制:1.0s   内存限制:256.0MB      问题描述 已 ...

  7. Idea安装lombok插件及使用

    安装lombok插件:File-settings 具体步骤如下图:1 2.找到Plugins 然后在搜索栏里搜索lombok 点击下放的Search in repositories 3.选中lombo ...

  8. Halcon中一些突然想不起来但确实有用的算子

    1.Develop dev_display  在现有图形窗口中显示图像目标. dev_set_color   设置一个或更多输出颜色,通常用于设置region或者xld的颜色. dev_set_dra ...

  9. T-sql GroupBy语句常见问题处理

    1.问题描述 现在有一张course表(含课程编号和名称)和一张sc表(含学生学号,选修课程的编号以及考试成绩),如下:现在想要查询所有课程编号.对应的课程名称以及选修该课程的所有学生的平均成绩.一开 ...

  10. 深入理解yield-乾颐堂

    yield的英文单词意思是生产,刚接触Python的时候感到非常困惑,一直没弄明白yield的用法. 只是粗略的知道yield可以用来为一个函数返回值塞数据,比如下面的例子: 1 2 3 def ad ...