设为首页 收藏本站
查看: 1271|回复: 0

[经验分享] ocp 1Z0-047 1-60题解析

[复制链接]

尚未签到

发表于 2015-6-16 11:03:24 | 显示全部楼层 |阅读模式
  1. You need to load information about new customers from the NEW_CUST table into the tables CUST and CUST_SPECIAL. If a new customer has a credit limit greater than 10,000, then the details have to be inserted into CUST_SPECIAL. All new customer details have to be inserted into the CUST table. Which technique should be used to load the data most efficiently?
A. external table
B. the MERGE command
C. the multitable INSERT command
D. INSERT using WITH CHECK OPTION
答案: C
分析: 本题考点是multitable INSERT
题目要求将NEW_CUST表上所有的记录插入CUST表,credit limit大于10000的记录要同时插入CUST_SPECIAL表,应该使用有条件的insert命令,sql如下:
insert all
  when credit_limit>=10000 into CUST_SPECIAL
  when 1=1 into CUST
A. 外部表是只读的,不能进行插入操作
B. merge命令只能针对一张表进行插入或者修改操作,不能针对多张表进行插入操作
D. insert命令没有with check option选项,with check option选项是create view时使用的
2. View the Exhibit and examine the description of the CUSTOMERS table. You want to add a constraint on the CUST_FIRST_NAME column of the CUSTOMERS table so that the value inserted in the column does not have numbers. Which SQL statement would you use to accomplish the task?
A. ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'^AZ')) NOVALIDATE;
B. ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'^[09]')) NOVALIDATE;
C. ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'[[:alpha:]]'))NOVALIDATE;
D. ALTER TABLE CUSTOMERS ADD CONSTRAINT cust_f_name CHECK(REGEXP_LIKE(cust_first_name,'[[:digit:]]'))NOVALIDATE;
答案: C
分析: 本题考点是正则表达式/REGEXP
要在表CUSTOMERS的字段CUST_FIRST_NAME建个约束,使这个字段不能包含数字
A. 匹配开头是AZ的字符串。
B. 匹配开头是0或者是9的字符串。
C. 匹配包含字母的字符串。
D. 匹配包含数字的字符串。
3. Which three tasks can be performed using regular expression support in Oracle Database 10g? (Choose three.)
A. It can be used to concatenate two strings.
B. It can be used to find out the total length of the string.
C. It can be used for string manipulation and searching operations.
D. It can be used to format the output for a column or expression having string data.
E. It can be used to find and replace operations for a column or expression having string data.
答案: CDE
分析: 本题考点是正则表达式/REGEXP
Oracle 10g支持正则表达式的函数主要有REGEXP_LIKE、REGEXP_INSTR、REGEXP_SUBSTR、REGEXP_REPLACE,用来寻找或替换匹配的字符串
A. 连接两个字符串用符号||,正则表达式没有这个功能。
B. 字符串的长度是用length()函数,正则表达式没有这个功能。
4. View the Exhibit and examine the structure of the EMP table which is not partitioned and not an indexorganized table. Evaluate the following SQL  statement:
ALTER TABLE emp DROP COLUMN first_name;
Which two statements are true regarding the above command? (Choose two.)
A. The FIRST_NAME column would be dropped provided it does not contain any data.
B. The FIRST_NAME column would be dropped provided at least one or more columns remain in the table.
C. The FIRST_NAME column can be rolled back provided the SET UNUSED option is added to the above SQL statement.
D. The FIRST_NAME column can be dropped even if it is part of a composite PRIMARY KEY provided the CASCADE option is used.
答案: BD
分析: 本题考点是set unused
EMP表不是分区表也不是所引组织表,drop columns是物理删除,set unused是逻辑删除,两者都不可以通过rollback恢复,所有引用到该列的对象都会失败。
A. 不管列上有没有数据,删除列的命令都可以正常执行。
C. set unused的列无法访问,无法使用rollback撤销unused设置
5. Evaluate the CREATE TABLE statement:
CREATE TABLE products (product_id NUMBER(6) CONSTRAINT prod_id_pk PRIMARY KEY, product_name VARCHAR2(15));
Which statement is true regarding the PROD_ID_PK constraint?
A. It would be created only if a unique index is manually created first.
B. It would be created and would use an automatically created unique index.
C. It would be created and would use an automatically created nonunique index.
D. It would be created and remains in a disabled state because no index is specified in the command.
答案: B
分析: 本题考点是主键约束和唯一性约束自动建立索引
Oracle在创建主键约束或唯一性约束时,会自动检测该列是否创建过唯一性索引,如果有则不创建而直接使用,如果没有则自动隐式创建唯一性索引。
A. 创建主键约束不需要首先手动创建唯一性索引,Oracle会自动隐式创建唯一性索引
C. 创建主键约束时,Oracle会自动隐式创建的索引是唯一性索引
D. 创建主键约束时没有指定索引,Oracle会自动寻找唯一性索引,找不到则会自动创建唯一性索引。所有约束创建时默认都是自动生效的
6. Which two statements are true? (Choose two.)
A. The USER_SYNONYMS view can provide information about private synonyms.
B. The user SYSTEM owns all the base tables and useraccessible views of the data dictionary.
C. All the dynamic performance views prefixed with V$ are accessible to all the database users.
D. The USER_OBJECTS view can provide information about the tables and views created by the user.
E. DICTIONARY is a view that contains the names of all the data dictionary views that the user can access.
答案: AE
分析: 本题考点是数据字典/data dictionary
B. system用户是操作系统管理员,sys才是数据库管理员,数据字典的所有基表和视图都属于sys用户。
C. v$为前缀的动态性能视图要有DBA权限才能访问。
D. USER_OBJECTS视图不仅包含用户的表、视图信息,还包括了其他对象如触发器、索引、过程等等。
7. View the Exhibit and examine the description of the ORDERS table. Which two WHERE clause conditions demonstrate the correct usage of conversion functions? (Choose two.)
A. WHERE order_date > TO_DATE('JUL 10 2006','MON DD YYYY')
B. WHERE TO_CHAR(order_date,'MON DD YYYY') = 'JAN 20 2003'
C. WHERE order_date > TO_CHAR(ADD_MONTHS(SYSDATE,6),'MON DD YYYY')
D. WHERE order_date IN ( TO_DATE('Oct 21 2003','Mon DD YYYY'), TO_CHAR('NOV 21 2003','Mon DD YYYY') )
D. WHERE order_date IN ( TO_DATE('Oct 21 2003','Mon DD YYYY'), TO_CHAR('NOV 21 2003','Mon DD YYYY') )
答案: AB
分析: 本题考点是日期格式/date type
C. order_date是timestamp with local timezone数据类型,TO_CHAR(ADD_MONTHS(SYSDATE,6),'MON DD YYYY')返回的是字符串,如果不符合系统时间格式则Oracle无法隐式转换,两者比较时会出错。
D. in是集合操作符,集合中TO_DATE('Oct 21 2003','Mon DD YYYY')返回date格式,TO_CHAR('NOV 21 2003','Mon DD YYYY')返回字符串,数据类型不一致。
8. View the Exhibit and examine the description of the EMPLOYEES table. Your company decided to give a monthly bonus of $50 to all the employees who have completed five years in the company. The following statement is written to display the LAST_NAME, DEPARTMENT_ID, and the total annual salary:
SELECT last_name, department_id, salary+50*12 "Annual Compensation" FROM employees WHERE MONTHS_BETWEEN(SYSDATE, hire_date)/12 >= 5;
When you execute the statement, the "Annual Compensation" is not computed correctly. What changes would you make to the query to calculate the annual compensation correctly?
A. Change the SELECT clause to SELECT last_name, department_id, salary*12+50 "Annual Compensation".
B. Change the SELECT clause to SELECT last_name, department_id, salary+(50*12) "Annual Compensation".
C. Change the SELECT clause to SELECT last_name, department_id, (salary+50)*12 "Annual Compensation".
D. Change the SELECT clause to SELECT last_name, department_id, (salary*12)+50 "Annual Compensation".
答案: C
分析: 本题要求为每个工作满5年的员工的月工资增加$50,返回他们的LAST_NAME、DEPARTMENT_ID和年薪,年薪=(salary+50)*12。
9. Evaluate the following CREATE SEQUENCE statement:
CREATE SEQUENCE seq1 START WITH 100 INCREMENT BY 10 MAXVALUE 200 CYCLE NOCACHE;
The sequence SEQ1 has generated numbers up to the maximum limit of 200. You issue the following SQL statement:
SELECT seq1.nextval FROM dual;
What is displayed by the SELECT statement?
A. 1
B. 10
C. 100
D. an error
答案: A
分析: 本题考点是序列/SEQUENCE
START WITH 100指定序列第一次使用是从100开始,INCREMENT BY 10指定序列每次使用增加10,MAXVALUE 200指定序列最大值为200,CYCLE指定序列可以循环使用,NOCACHE指定序列不使用缓存。序列没有设置minvalue参数,所以这个序列第一次使用从100开始,每用1次增加10,达到最大值200后循环到minvalue,由于没有设置minvalue,所以使用默认值1。
  10. View the Exhibit and examine the description of the EMPLOYEES table. You want to display the EMPLOYEE_ID, FIRST_NAME, and DEPARTMENT_ID for all the employees who work in the same department and have the same manager as that of the employee having EMPLOYEE_ID 104. To accomplish the task, you execute the following SQL statement:
SELECT employee_id, first_name, department_id FROM employees WHERE (manager_id, department_id) =(SELECT department_id, manager_id FROM employees WHERE employee_id = 104) AND employee_id  104
When you execute the statement it does not produce the desired output. What is the reason for this?
A. The WHERE clause condition in the main query is using the = comparison operator, instead of EXISTS.
B. The WHERE clause condition in the main query is using the = comparison operator, instead of the IN operator.
C. The WHERE clause condition in the main query is using the = comparison operator, instead of the = ANY operator.
D. The columns in the WHERE clause condition of the main query and the columns selected in the subquery should be in the same order.
答案: D
分析: 本题考点是组合列
where子句的(manager_id, department_id)作为组合列,要求子查询返回的也是一个结构相同的组合列,而不是(department_id, manager_id)
11. View the Exhibit and examine the descriptions of ORDER_ITEMS and ORDERS tables. You want to display the CUSTOMER_ID, PRODUCT_ID, and total (UNIT_PRICE multiplied by QUANTITY) for the order placed. You also want to display the subtotals for a CUSTOMER_ID as well as for a PRODUCT_ID for the last six months.
Which SQL statement would you execute to get the desired output?
A. SELECT o.customer_id, oi.product_id, SUM(oi.unit_price*oi.quantity) "Total" FROM order_items oi JOIN orders o ON oi.order_id=o.order_id GROUP BY ROLLUP (o.customer_id,oi.product_id) WHERE MONTHS_BETWEEN(order_date, SYSDATE)

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-77895-1-1.html 上篇帖子: 11g OCP 053 下篇帖子: ocp 1Z0-047 61-130题解析
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表