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

SQLÓï¾äÓÅ»¯¼¼Êõ

SQLÓï¾äÓÅ»¯¼¼Êõ·ÖÎö
²Ù×÷·ûÓÅ»¯
IN ²Ù×÷·û
ÓÃINд³öÀ´µÄSQLµÄÓŵãÊDZȽÏÈÝÒ×д¼°ÇåÎúÒ׶®£¬Õâ±È½ÏÊʺÏÏÖ´úÈí¼þ¿ª·¢µÄ·ç¸ñ¡£
µ«ÊÇÓÃINµÄSQLÐÔÄÜ×ÜÊDZȽϵ͵ģ¬´ÓORACLEÖ´ÐеIJ½ÖèÀ´·ÖÎöÓÃINµÄSQLÓë²»ÓÃINµÄSQLÓÐÒÔÏÂÇø±ð£º
 ¡¡¡¡¡¡ORACLEÊÔͼ½«Æäת»»³É¶à¸ö±íµÄÁ¬½Ó£¬Èç¹ûת»»²»³É¹¦ÔòÏÈÖ´ÐÐINÀïÃæµÄ×Ó²éѯ£¬ÔÙ²éѯÍâ²ãµÄ±í¼Ç¼£¬Èç¹ûת»»³É¹¦ÔòÖ±½Ó²ÉÓöà¸ö±íµÄÁ¬½Ó·½Ê½²éѯ¡£Óɴ˿ɼûÓÃINµÄSQLÖÁÉÙ¶àÁËÒ»¸öת»»µÄ¹ý³Ì¡£Ò»°ãµÄSQL¶¼¿ÉÒÔת»»³É¹¦£¬µ«¶ÔÓÚº¬ÓзÖ×éͳ¼ÆµÈ·½ÃæµÄSQL¾Í²»ÄÜת»»ÁË¡£
 ¡¡¡¡¡¡ÍƼö·½°¸£ºÔÚÒµÎñÃܼ¯µÄSQLµ±Öо¡Á¿²»²ÉÓÃIN²Ù×÷·û¡£
NOT IN²Ù×÷·û
 ¡¡¡¡¡¡´Ë²Ù×÷ÊÇÇ¿ÁÐÍƼö²»Ê¹Óõģ¬ÒòΪËü²»ÄÜÓ¦ÓñíµÄË÷Òý¡£
 ¡¡¡¡¡¡ÍƼö·½°¸£ºÓÃNOT EXISTS »ò£¨ÍâÁ¬½Ó+ÅжÏΪ¿Õ£©·½°¸´úÌæ
<> ²Ù×÷·û£¨²»µÈÓÚ£©
 ¡¡¡¡¡¡²»µÈÓÚ²Ù×÷·ûÊÇÓÀÔ¶²»»áÓõ½Ë÷ÒýµÄ£¬Òò´Ë¶ÔËüµÄ´¦ÀíÖ»»á²úÉúÈ«±íɨÃè¡£
ÍƼö·½°¸£ºÓÃÆäËüÏàͬ¹¦ÄܵIJÙ×÷ÔËËã´úÌ棬Èç
 ¡¡¡¡¡¡a<>0 ¸ÄΪ a>0 or a<0
 ¡¡¡¡¡¡a<>’’ ¸ÄΪ a>’’
IS NULL »òIS NOT NULL²Ù×÷£¨ÅжÏ×Ö¶ÎÊÇ·ñΪ¿Õ£©
 ¡¡¡¡¡¡ÅжÏ×Ö¶ÎÊÇ·ñΪ¿ÕÒ»°ãÊDz»»áÓ¦ÓÃË÷ÒýµÄ£¬ÒòΪBÊ÷Ë÷ÒýÊDz»Ë÷Òý¿ÕÖµµÄ¡£
 ¡¡¡¡¡¡ÍƼö·½°¸£º
ÓÃÆäËüÏàͬ¹¦ÄܵIJÙ×÷ÔËËã´úÌ棬Èç
 ¡¡¡¡¡¡a is not null ¸ÄΪ a>0 »òa>’’µÈ¡£
 ¡¡¡¡¡¡²»ÔÊÐí×Ö¶ÎΪ¿Õ£¬¶øÓÃÒ»¸öȱʡֵ´úÌæ¿ÕÖµ£¬ÈçÒµÀ©ÉêÇëÖÐ״̬×ֶβ»ÔÊÐíΪ¿Õ£¬È±Ê¡ÎªÉêÇë¡£
 ¡¡¡¡¡¡½¨Á¢Î»Í¼Ë÷Òý£¨ÓзÖÇøµÄ±í²»Äܽ¨£¬Î»Í¼Ë÷Òý±È½ÏÄÑ¿ØÖÆ£¬Èç×Ö¶Îֵ̫¶àË÷Òý»áʹÐÔÄÜϽµ£¬¶àÈ˸üвÙ×÷»áÔö¼ÓÊý¾Ý¿éËøµÄÏÖÏó£©
> ¼° < ²Ù×÷·û£¨´óÓÚ»òСÓÚ²Ù×÷·û£©
 ¡¡¡¡¡¡´óÓÚ»òСÓÚ²Ù×÷·ûÒ»°ãÇé¿öÏÂÊDz»Óõ÷ÕûµÄ£¬ÒòΪËüÓÐË÷Òý¾Í»á²ÉÓÃË÷Òý²éÕÒ£¬µ«ÓеÄÇé¿öÏ¿ÉÒÔ¶ÔËü½øÐÐÓÅ»¯£¬ÈçÒ»¸ö±íÓÐ100Íò¼Ç¼£¬Ò»¸öÊýÖµÐÍ×Ö¶ÎA£¬30Íò¼Ç¼µÄA=0£¬30Íò¼Ç¼µÄA=1£¬39Íò¼Ç¼µÄA=2£¬1Íò¼Ç¼µÄA=3¡£ÄÇôִÐÐA>2ÓëA>=3µÄЧ¹û¾ÍÓкܴóµÄÇø±ðÁË£¬ÒòΪA>2ʱORACLE»áÏÈÕÒ³öΪ2µÄ¼Ç¼Ë÷ÒýÔÙ½øÐбȽϣ¬¶øA>=3ʱORACLEÔòÖ±½ÓÕÒµ½=3µÄ¼Ç¼Ë÷Òý¡£
LIKE²Ù×÷·û
LIKE²Ù×÷·û¿ÉÒÔÓ¦ÓÃͨÅä·û²éѯ£¬ÀïÃæµÄͨÅä·û×éºÏ¿ÉÄÜ´ïµ½¼¸ºõÊÇÈÎÒâµÄ²éѯ£¬µ«ÊÇÈç¹ûÓõò»ºÃÔò»á²úÉúÐÔÄÜÉϵÄÎÊÌ⣬ÈçLIKE ‘%5400%’ ÕâÖÖ²éѯ²»»áÒýÓÃË÷Òý£


Ïà¹ØÎĵµ£º

º½¿Õ¹«Ë¾¹ÜÀíϵͳ(VC++ ÓëSQL 2005)

ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
      ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......

oraleÖÐsqlÓï¾ä¶ÔnullÖµµÄ´¦Àí

µÚÒ»ÖÖ·½·¨£ºÊ¹ÓÃNVLº¯Êý´¦ÀíNULLÖµ¡£
ÆäÓï·¨¸ñʽÊÇNVL(exp1,exp2)¡£ÆäÖвÎÊýexp1ºÍexp2¿ÉÒÔʹÈÎÒâÊý¾ÝµÄÀàÐÍ£¬µ«Á½ÕßÊý¾ÝÀàÐͱØÐëÆ¥Å䡣ʾÀý£ºselect ename,sal,comm,sal+nvl(comm,0) as salary from emp;
µÚ¶þÖÖ·½·¨£ºÊ¹ÓÃNVL2º¯Êý´¦ÀíNULLÖµ¡£
ÆäÓï·¨¸ñʽÊÇNVL2(exp1,exp2,exp3)¡£ÕâÊÇoracle9iÐÂÔö¼ÓµÄº¯Êý¡£Èç¹ûexp1 ......

sql2005 Á´½Ó·þÎñÆ÷ Á¬½ÓOracle...

Ò»¡¢½¨Á¢Á´½Ó·þÎñÆ÷
       ÓÐÈËϲ»¶µ÷ÓÃϵͳ¹ý³ÌÀ´½¨Á¢£¬µ«ÎÒ¸öÈ˶Ôϵͳ¹ý³ÌûÓÐÌرðµÄѧϰ £¬ËùÒÔÓõÄÊǽçÃæÉèÖ㬵±È»ÓÐÐËȤҲ¿ÉÒÔÑо¿Ò»Ïµģ¬ÒòΪ¿ÉÒÔ°ÑSQLÖ´Ðе¼³öÀ´¡£
USE [master]
GO
EXEC master.dbo.sp_addlinkedserver @server = N'TEST2', @srvproduct=N'ORCL', @provider=N ......

ASP.NET·ÀSQL×¢Èë½Å±¾³ÌÐò

public class SqlCheck  
{  
    public SqlCheck()  
    {  
        //  
        // TODO: ÔÚ´Ë´¦Ìí¼Ó¹¹Ô캯ÊýÂß¼­  
  & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ