zoukankan      html  css  js  c++  java
  • 子查询

    个人理解的子查询就是随便怎么套,不怕你套的多,就怕你把自己套乱了。

    Let us see see

    Select Cname,Ccontract

    From Customers

    Where Cid in

    (select Cid From Orders where Onum in

    (select Onum From OrderInfoDetial where Pid=’Agilesoft’)

    )

    由内而外,分析清楚就可以了。

    Exists和In

    Select CId,Cname from Customers

    Where Exists(

    Select * from Orders where DateDiff(month,Odate,’2012-07-01’)=0

    And customers.CId=orders.CId)

    查询的是2012年7月份下订单的顾客名称以及顾客编号

    在这里,使用In是一样的效果。那么Exists与In的区别在哪儿?

    最大的区别是性能上的区别。

    Sometimes,使用Exists的语句处理比使用In的快些。多试验试验也不是什么坏事额。

  • 相关阅读:
    学习进度总结表
    关于软件工程的问题
    自我介绍
    web安全
    spring profile
    spring 装配
    python Descriptor (描述符)
    python string intern
    Java 对象内存占用
    java jdb命令详解
  • 原文地址:https://www.cnblogs.com/howie/p/2607077.html
Copyright © 2011-2022 走看看