设为首页 加入收藏

TOP

ocp1Z0-051106-140题解析(五)
2014-11-24 08:07:01 来源: 作者: 【 】 浏览:28
Tags:ocp1Z0-051106-140 解析
LECTpromo_category,sum(promo_cost)

FROM promotions

GROUP BY promo_category

HAVINGMIN(promo_end_date-promo_begin_date)>30;

Which statement is trueregarding the above two SQL statements

\

A. statement 1 gives anerror, statement 2 executes successfully

B. statement 2 gives anerror, statement 1 executes successfully

C. statement 1 andstatement 2 execute successfully and give the same output

D. statement 1 andstatement 2 execute successfully and give a different output

Answer: D

解析:

都无语法错误,statement 1先筛选行,再进行分组排列

Statement 2 先分组,再筛选,测试:
scott@ORCL>select job,sum(sal) from emp where sysdate-hiredate>11700group by job;

JOB SUM(SAL)

--------- ----------

CLERK 968

SALESMAN 5600

PRESIDENT 6300

MANAGER 8749.24

scott@ORCL>selectjob,sum(sal) from emp group by job having min(sysdate-hiredate)>11700;

JOB SUM(SAL)

--------- ----------

SALESMAN 5600

PRESIDENT 6300

MANAGER 8749.24

119. Examine the data inthe ORD_ITEMS table:

ORD_NO ITEM_NO QTY

1 111 10

1 222 20

1 333 30

2 333 30

2 444 40

3 111 40

eva luate the followingquery:

SQL>SELECT item_no,AVG(qty)

FROM ord_items

HAVING AVG(qty) >MIN(qty) * 2

GROUP BY item_no;

Which statement is trueregarding the outcome of the above query

A. It gives an errorbecause the HAVING clause should be specified after the GROUP BY clause.

B. It gives an errorbecause all the aggregate functions used in the HAVING clause must be specifiedin

the SELECT list.

C. It displays the itemnos with their average quantity where the average quantity is more than doublethe

minimum quantity of thatitem in the table.

D. It displays the itemnos with their average quantity where the average quantity is more than doublethe

overall minimum quantityof all the items in the table.

Answer: C

解析:
没有语法错误,得到item_no, AVG(qty)并且AVG(qty) >MIN(qty) * 2

所以C选择正确

120. View the Exhibitsand examine the structures of the PRODUCTS, SALES, and CUSTOMERS

tables.

You issue the followingquery:

SQL>SELECTp.prod_id,prod_name,prod_list_price,

quantity_sold,cust_last_name

FROM products p NATURALJOIN sales s NATURAL JOIN customers c

WHERE prod_id =148;

Which statement is trueregarding the outcome of this query

A. It executessuccessfully.

B. It produces an errorbecause the NATURAL join can be used only with two tables.

C. It produces an errorbecause a column used in the NATURAL join cannot have a qualifier.

D. It produces an errorbecause all columns used in the NATURAL join should have a qualifier.

Answer: C

解析:
引用官方文档:

When specifying columnsthat are involved in the natural join, do not qualify

the column name with atable name or table alias.

所以C选项正确

121. Which twostatements are true regarding the USING clause in table joins (Choose two .)

A. It can be used tojoin a maximum of three tables.

B. It can be used torestrict the number of columns used in a NATURAL join.

C. It can be used toaccess data from tables through equijoins as well as nonequijoins.

D. It can be used tojoin tables that have columns with the same name and compatible data types.

Answer: BD

解析:

引用官方文档:

When you are specifyingan equijoin of columns that have the same

name in both tables, theUSING column clause indicates the columns to be used. You

can use this clause onlyif the join columns in both tables have the same name. Within

this clause, do notqualify the column name with a table name or table alias.

Restriction on the USINGcolumn Clause

■ Within this clause, donot qualify the column name with a table name or table

alias.

■ Yo

首页 上一页 2 3 4 5 6 7 8 下一页 尾页 5/10/10
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇DBA手记:DBA诊断利器 - Event 100.. 下一篇Oracle 11g New 使用数据恢复指导

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·上海启源芯动力的福 (2025-12-26 20:50:23)
·为什么动力电池安全 (2025-12-26 20:50:20)
·动力电池是怎么造出 (2025-12-26 20:50:18)
·C 内存管理 | 菜鸟教 (2025-12-26 20:20:37)
·如何在 C 语言函数中 (2025-12-26 20:20:34)