Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ÌÐò½çÃ棬ºóÃæ ......

ÇÉÓÃSQLÖеÄWITH£¨Ê÷ÐͽṹÊý¾ÝµÄ²éѯ£©

Èç¹û±íÖдæ·ÅµÄÊý¾ÝÊÇÊ÷Ðνṹ£¬µ±ÖªµÀijһ¸ö½ÚµãµÄֵʱ£¬Í¬Ê±ÏëÈ¡µÃËüËùÓÐ×Ó½ÚµãµÄÊý¾Ý¡£
±í½á¹¹£º
        
         
 ±íÖдæ·ÅµÄÊDz¿ÃÅ×éÖ¯½á¹¹£¬ BMN_CD²¿ÃÅ£¬SSK_KAISO_LVÊǽײ㣬BMN_MKJ²¿ÃÅÃû³Æ£¬JOI_KAISO_LVÉÏ ......

ÈçºÎ²éѯSQL Server±¸·Ý»¹Ô­ÀúÊ·¼Ç¼

SQL ServerÔÚmsdbÊý¾ÝÖÐά»¤ÁËһϵÁÐ±í£¬ÓÃÀ´´æ´¢Ö´ÐÐËùÓб¸·ÝºÍ»¹Ô­µÄϸ½ÚÐÅÏ¢¡£¼´Ê¹ÄãÕýÔÚʹÓõÚÈý·½µÄ±¸·ÝÓ¦ÓóÌÐò£¬Ö»ÒªÕâ¸öÓ¦ÓóÌÐòʹÓÃSQL ServerµÄÐéÄâÉ豸½Ó¿Ú(Virtual Device Interface---VDI)À´Ö´Ðб¸·ÝºÍ»¹Ô­Ö´ÐУ¬ÄÇôִÐÐϸ½ÚÒÀÈ»±»´æ´¢ÔÚÕâһϵÁбíÖС£
´æ´¢Ï¸½ÚµÄ±í°üÀ¨£º
backupset 
backupfile&n ......

°²×°Oracle 10g inistant clientºóÊÇPL/SQL³öÏÖÂÒÂë

ÏëʹÓÃPL/SQL¿ª·¢¹¤¾ß£¬µ«²»Ïë°²×°ÄǸö¼¸°ÙÕ×µÄoracle¿Í»§¶Ë£¬ÓÚÊÇ°²×°ÁËoracle 10g inistant client£¬40¶àM°É¡£
°²×°ºóPL/SQL¿ÉÒÔÓÃÁË£¬µ«ÊDzéѯ³ö¼Ç¼ÀïÃæµÄÖÐÎÄÈ´ÊÇÂÒÂë¡£ÕÛÌÚÁ˺þòÅÕÒ³ö½â¾ö·½·¨£º
ÉèÖû·¾³±äÁ¿£ºNLS_LANG£¬ÖµÎªOracleÊý¾Ý¿âÉèÖõÄ×Ö·û¼¯£¬ÔÚÎÒµÄϵͳÀïÃæÉèÖÃÊÇ£ºSIMPLIFIED CHINESE_CHINA.ZHS16GBK ......

SQL¾­µäÃæÊÔÌâ¼°´ð°¸

1.Ò»µÀSQLÓï¾äÃæÊÔÌ⣬¹ØÓÚgroup by
±íÄÚÈÝ£º
2005-05-09 ʤ
2005-05-09 ʤ
2005-05-09 ¸º
2005-05-09 ¸º
2005-05-10 ʤ
2005-05-10 ¸º
2005-05-10 ¸º
Èç¹ûÒªÉú³ÉÏÂÁнá¹û, ¸ÃÈçºÎдsqlÓï¾ä?
            ʤ ¸º
2005-05-09 2 2
2005-05-10 1 2
------ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ