下面是主题给出来的查询语句
找出所有支行的集合中是否包含坐落在Brooklyn的所有支行的集合
select distince S.customer_name
from depositor as S
where not exists((select branch_name
from branch
where branch_city = 'Brooklyn')
except
(select R.branch_name
from R.branch_name
where T.account_number=R.account_number and S.customer_name=T.customer_name))
这里两处..一处是not exists 一点都不明白..
另之处两个关系进行 except ? 是第一select branch_name from branch where branch_city = 'Brooklyn') 拿出一行与下面的集合进行比较然后返回布尔值吗?
找出所有支行的集合中是否包含坐落在Brooklyn的所有支行的集合
select distince S.customer_name
from depositor as S
where not exists((select branch_name
from branch
where branch_city = 'Brooklyn')
except
(select R.branch_name
from R.branch_name
where T.account_number=R.account_number and S.customer_name=T.customer_name))
这里两处..一处是not exists 一点都不明白..
另之处两个关系进行 except ? 是第一select branch_name from branch where branch_city = 'Brooklyn') 拿出一行与下面的集合进行比较然后返回布尔值吗?
解决方案 »
- 有关时间比较的问题?
- 一个在Query Designer 的问题
- 求某月天数的最简单写法,上贴同结
- 不知道这个SQL怎么写了。也不知道怎么取名。暂且叫做【分组取前top N】的问题
- 有关游标的问题
- 在线等(win98连2000SQL)
- csdn有人会吗,在线急等 100 谢谢
- 我在企业管理期利新建立一个 注册,不能连接上局域网的 sql server
- 求FoxBase!DOS版或window版,[email protected]或给出链接,谢谢~!
- 在进行数据导入时,将一个表的数据导入到另一个表里,数类型设置都相同,导入报错
- 问一个Cpnnection连接时间的问题
- SQL里边,一对多关系,但在主键那个表,不显示那个像Access中的“+”号的?
2.except从左查询中返回右查询没有找到的所有非重复值。
exists ,not exists 好比 in ,not in
except 两个表结构要相同,从左查询中返回右查询没有找到的所有非重复值。
找出所有支行的集合中是否包含坐落在Brooklyn的所有支行的集合
select distince S.customer_name
from depositor as S
where not exists((select branch_name
from branch
where branch_city = 'Brooklyn')
except
(select R.branch_name
from R.branch_name
where T.account_number=R.account_number and S.customer_name=T.customer_name))
这里两处..一处是not exists
另之处两个关系进行 except ? 是第一select branch_name from branch where branch_city = 'Brooklyn') 拿出的结合与排除下面的集合理解1:找出所有客户, 而这些客户在'Brooklyn'都有存折理解2:不存在在'Brooklyn'支行中的所有银行中没有开过所有存折的客户