没有合适的资源?快使用搜索试试~ 我知道了~
ocp考试 047 原题解析
5星 · 超过95%的资源 需积分: 10 60 下载量 9 浏览量
2013-03-12
16:36:50
上传
评论 4
收藏 453KB DOC 举报
温馨提示
试读
64页
刚考过了ocp 因为英语不太好 花了很大功夫 考完把自己的笔记放出来 每道题都有为什么选某个答案的解析 省去查英语查知识点的功夫 希望能对各位有帮助。 随后053 052的试题也会慢慢整理出来 题量巨大,需要时间 谢谢
资源推荐
资源详情
资源评论
a
1Z0-047 51-100
1Z0-047 1-50
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)
<= 6
B. 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) HAVING MONTHS_BETWEEN(order_date, SYSDATE)
<= 6
C. 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)
>= 6
D. 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 WHERE
MONTHS_BETWEEN(order_date, SYSDATE) <= 6 GROUP BY ROLLUP
(o.customer_id, oi.product_id)
答案: D
分析: 本题考点是WHERE与HAVING的区别ò
A. where要写在group by之前
B. having子句中的列要在select子句中出现
剩余63页未读,继续阅读
morningsailing
- 粉丝: 0
- 资源: 18
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页