首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

OCP试题解析_007: 内联视图优化all或any操作符

2013-03-04 
OCP考题解析_007: 内联视图优化all或any操作符个人的理解, 内联视图通常是指: 一个SQL查询的结果作为另一

OCP考题解析_007: 内联视图优化all或any操作符
       个人的理解, 内联视图通常是指: 一个SQL查询的结果作为另一个查询的数据源, 一般在 From字句后面
       
       any表示数据集中的任何一个、相当于or
       x > any (select sal from emp where job='ANA')
       等价于:
       exists (select sal from emp where job='ANA' and x > sal)
       
       使用ALL和ANY的子查询总是可以用内嵌视图来代替,而且这个视图的性能要好的多,因为它利用了被连接表上的索引
       
       比如:any操作符
       

       需求:返回所有birthday > 出生于1985年之后的任何客户 的职员名称

Q: 8 Click the Exhibit button and examine the data from the ORDERS andCUSTOMERS tables.Evaluate this SQL statement:SELECT cust_id, ord_totalFROM ordersWHERE ord_total > ANY(SELECT ord_totalFROM ordersWHERE cust_id IN (SELECT cust_idFROM customersWHERE city LIKE'New York'));What is the result when the above query is executed?  


热点排行