Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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


Ïà¹ØÎĵµ£º

ORACLEºÍPOSTGRESQLµÄSQLÓï¾ä±È½Ï

oracle ·½·¨                                                & ......

SQLÓï¾äPART6

Differring Constraints:
Constraints can have the following attributes: DEFFERRABLE / NOT DEFFERRABLE,  INITIALLY DEFFERRED / INITIALLY IMMEDIATE.
e.g.:
alter table dept2 add constraint dept2_id_pk primary key (department_id) deferrable initially deferred; // deferring constraint on creation. ......

SQLÖÐJOINµÄʹÓÃ


(×¢:outerµÄÒâ˼¾ÍÊÇ"ûÓйØÁªÉϵÄÐÐ"¡£)
1.cross join È«ÍâÁ¬½Ó(µÑ¿¨¶û³Ë»ý)
SELECT A.*, B.* from A FULL OUTER JOIN B ON A.ID = B.ID
2.inner join ÄÚÁ¬½Ó(Ôڵѿ¨¶û³Ë»ýµÄ½á¹û¼¯ÖÐÈ¥µô²»·ûºÏÁ¬½ÓÌõ¼þµÄÐÐ)
SELECT A.* from A INNER JOIN B ON A.ID=B.ID
3.left outer join ×óÍâÁ¬½Ó(ÔÚinner joinµÄ½á¹ ......

linq to sqlÉú³Énot inÓï¾äµÄС¼¼ÇÉ

ÒÔǰһֱ¾õµÃlinq to sqlÉú³ÉÀàËÆwhere id not in (1,3,5)»òwhere id not in (select id from ...)ÕâÑùµÄÌõ¼þ²»ÊǺܷ½±ã£¬Ã¿´ÎÎÒ¶¼ÊǰÑÌõ¼þIDÊÂÏÈÈ¡µ½Ò»¸öÊý×éÀȻºóÓà !Arr.Contains(c.Id)ÕâÑù´¦Àí£¬½ñÌìͻȻ·¢ÏÖÕâÑùºÃɵ£¬Æäʵ¿ÉÒÔÍêȫֱ½ÓÓÃlinqд³ÉÒ»¾ä£¬Ìù¸öʾÀýÔÚÕâÀÒԺ󱸲é
from a in TableA where !(fr ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ