zoukankan      html  css  js  c++  java
  • 【OCP12c】CUUG最新考试原题整理及答案(0719)

    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 子句中。)

  • 相关阅读:
    python字典类型
    python集合类型
    python元组类型
    python列表类型
    Python中的序列操作
    python字符串格式化输出
    python可变对象和不可变对象的解释
    Python数值类型
    Python循环结构用法
    python if条件判断语句
  • 原文地址:https://www.cnblogs.com/cnblogs5359/p/10382576.html
Copyright © 2011-2022 走看看