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. HashMap、HashTable的区别

    HashMap和HashTable都实现了Map接口,但是要用哪个要分清它们之间的区别. 它们的主要区别:线程安全性.速度 HashMap几乎可以等价于HashTable除了HashMap是非sync ...

  2. Slim安装以及使用【转】

    最近在用backbone.js 做东西,因为牵扯到REST services 所以需要后台支持,此处选择了php.Slim 是php的一个框架. 貌似国内文章对此的介绍比较少,在安装Slim的过程中出 ...

  3. NoSuchBeanDefinitionException:No qualifying bean of type found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency.

    报错如下: NoSuchBeanDefinitionException:No qualifying bean of type   found for dependency: expected at l ...

  4. 如何用shell脚本执行或关闭jar包服务?

    现在springboot很流行,但是大家都知道springboot是以jar包的方式进行打包的,那样就少不了开启或关闭服务的操作了,但是命令方式未免过于繁琐. 下面记录shell脚本的方式启动或关闭服 ...

  5. Codeforces 1154F (DP)

    题意:有一个人去买铲子,他需要买正好k把.每把铲子有个标价,并且每把铲子最多只能被买一次.有m种优惠方案,每个优惠方案xi, yi是指如果这次恰好购买了xi把铲子,那么这次购买的铲子中最便宜的yi把将 ...

  6. 226. Invert Binary Tree 翻转二叉树

    [抄题]: Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 [暴力解法]: 时间分析: 空间分 ...

  7. RedisHelper in C#

    自己写了一个RedisHelper,现贴出来,希望各位大神能够指正和优化. using System; using StackExchange.Redis; using System.Configur ...

  8. 实践作业3:白盒测试----第三次小组会DAY8

    我们小组于12月11日在东九教学楼召开了会议,小组第二次会议中就讨论了被测系统中风险最高的模块,于是选择管理员的教师添加模块,针对代码展开静态评审.这一次会议,小组主要讨论了应该从哪些方面来测评代码的 ...

  9. JS作用域理解(声明提升)

    1.JS解析步骤: a.预解析 将变量声明提升: 将函数声明及函数内容提升,可以理解成原来位置的函数在解析代码时已经提到代码初始位置: 块内的变量声明和函数声明也会被提升,例如if语句 遇到重名,只留 ...

  10. [GO]tcp网络通信和实现

    服务端的代码 package main import ( "net" "fmt" ) func main() { //监听 listener, err := n ...