zoukankan      html  css  js  c++  java
  • OCP-1Z0-051-V9.02-2题

    2. View the Exhibit to examine the description for the SALES table.

    Which views can have all DML operations performed on it? (Choose all that apply.) 

    A. CREATE VIEW v3

    AS SELECT * FROM SALES   

    WHERE cust_id = 2034   

    WITH CHECK OPTION;

    B. CREATE VIEW v1

    AS SELECT * FROM SALES   

    WHERE time_id <= SYSDATE - 2*365   

    WITH CHECK OPTION;

    C. CREATE VIEW v2

    AS SELECT prod_id, cust_id, time_id FROM SALES   

    WHERE time_id <= SYSDATE - 2*365   

    WITH CHECK OPTION; 

    D. CREATE VIEW v4

    AS SELECT prod_id, cust_id, SUM(quantity_sold) FROM SALES   

    WHERE time_id <= SYSDATE - 2*365   

    GROUP BY prod_id, cust_id   

    WITH CHECK OPTION;

    Answer: AB

    答案解析:

    参考:

    C不正确的原因为有其它列不能为空

    D出错,sum(quantity_sold)需要加个别名

    sh@TESTDB> create view v4

      2  as select prod_id,cust_id,sum(quantity_sold) from sales
      3  where time_id<=sysdate-2*365
      4  group by prod_id,cust_id
      5  with check option
      6  ;
    as select prod_id,cust_id,sum(quantity_sold) from sales
                              *
    ERROR at line 2:
    ORA-00998: must name this expression with a column alias
    sh@TESTDB> create view v4
      2  as select prod_id,cust_id,sum(quantity_sold) sumqty from sales
      3   where time_id<=sysdate-2*365
      4  group by prod_id,cust_id
      5  with check option
      6  ;
  • 相关阅读:
    2017免费获取正版win10的方法
    Apache <Directory>… </Directory>配置
    针对left join以及limit的两条优化小技巧
    win10打印机突然无法启动
    mysql中的分组统计函数及其用法实例
    程序猿的日常生活-雨中
    java中的反射
    mysql中的截取函数及其实例
    集合与数组
    方法重写
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13316825.html
Copyright © 2011-2022 走看看