sql server中in和exists的小区别 oracle未测试
in 的话, 如果是null 就不比较了,既不是in 也不是 not in
exists的话 因为用 = 加在条件里比较了,所以 null 是 not exists
select *
from pricetemp
where cast(商品コード as varchar(10))not in(
select shohin_cd
from m_price)
select *
from pricetemp
where not exists (select shohin_cd
from m_price
where cast(pricetemp.商品コード as varchar(10))=m_price.shohin_cd)
以上2条会有不同的结果,因为 pricetemp.商品コード 有很多 null
相关文档:
Confirming granted privileges
Data Dictionary View Description
ROLE_SYS_PRIVS System privileges granted to roles
ROLE_TAB_PRIVS & ......
CREATE VIEW MYVIEW
AS
SELECT * from bjxxdiweb_database2007.dbo.bm_tongji
UNION ALL
SELECT * from aa.DBO.chen
select * into aa..chen from bjxxdiweb_database2007.dbo.bm_tongji where 1=2
说明:数据库A的表的字段名必须和数据库B的表的字段名相同,包括数据类型等。 ......
oracle tips
Exist的用法:
select gw.ndocid from
(select ndocid from wf_doc_gw_shouwen union select ndocid from wf_doc_gw_fawen) gw
where
not exists (select null from wf_doc_gw_sn sn where sn.ndocid=gw.ndocid)
2。把GW表和SN表里相同的NDOCID显示出来
select gw.ndocid from
(se ......
在程序的开发过程中,处理分页是大家接触比较频繁的事件,因为现在软件基本上都是与数据库进行挂钓的。但效率又是我们所追求的,如果是像原来那样把所有满足条件的记录全部都选择出来,再去进行分页处理,那么就会多多的浪费掉许多的系统处理时间。为了能够把效率提高,所以现在我们就只选择我们需要的数据,减少数据 ......
数据类型
在 Microsoft SQL Server中,每个列、局部变量、表达式和参数都有一个相关的数据类型,这是指定对象可持有的数据类型(整型、字符、money 等等)的特性。SQL Server 提供系统数据类型集,定义了可与 SQL Server 一起使用的所有数据类型。下面列出系统提供的数据类型集。
可以定义用户定义的数据类型,其是系统提 ......