sqlÓï¾äÓÅ»¯
²Ù×÷·ûÓÅ»¯
IN ²Ù×÷·û
ÓÃINд³öÀ´µÄSQLµÄÓŵãÊDZȽÏÈÝÒ×д¼°ÇåÎúÒ׶®£¬Õâ±È½ÏÊʺÏÏÖ´úÈí¼þ¿ª·¢µÄ·ç¸ñ¡£
µ«ÊÇÓÃINµÄSQLÐÔÄÜ×ÜÊDZȽϵ͵ģº
Êý¾Ý¿âÊÔͼ½«Æäת»»³É¶à¸ö±íµÄÁ¬½Ó£¬Èç¹ûת»»²»³É¹¦ÔòÏÈÖ´ÐÐ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ʱÊý¾Ý¿â»áÏÈÕÒ³öΪ2µÄ¼Ç¼Ë÷ÒýÔÙ½øÐбȽϣ¬¶øA>=3ʱÊý¾Ý¿âÔòÖ±½ÓÕÒµ½=3µÄ¼Ç¼Ë÷Òý¡£
LIKE²Ù×÷·û
LIKE ²Ù×÷·û¿ÉÒÔÓ¦ÓÃͨÅä·û²éѯ£¬ÀïÃæµÄͨÅä·û×éºÏ¿ÉÄÜ´ïµ½¼¸ºõÊÇÈÎÒâµÄ²éѯ£¬µ«ÊÇÈç¹ûÓõò»ºÃÔò»á²úÉúÐÔÄÜÉϵÄÎÊÌ⣬ÈçLIKE ‘%5400%’ ÕâÖÖ²é
Ïà¹ØÎĵµ£º
http://www.umgr.com/blog/PostView.aspx?bpId=36294
1. Ö´ÐÐsqlÓï¾ä
int sqlite3_exec(sqlite3*£¬ const char *sql£¬ sqlite3_callbacksql Óï·¨
£¬ void *£¬ char **errmsg );
Õâ¾ÍÊÇÖ´ÐÐÒ»Ìõ sql Óï¾äµÄº¯Êý¡£
µÚ1¸ö²ÎÊý²»ÔÙ˵ÁË£¬ÊÇÇ°Ãæopenº¯ÊýµÃµ½µÄÖ¸Õ롣˵ÁËÊǹؼüÊý¾Ý½á¹¹¡£
µÚ2¸ö²ÎÊýconst char ......
1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......
µ¼Èë·½·¨£ºÍ¨¹ýMsSqlDump¹¤¾ßÉú³Ésql½Å±¾²¢µ¼Èë
µ¼ÈëMSSQLÊý¾Ý¿âµÄµÚÈýÖÖ·½·¨£¬ÊÇͨ¹ýµÚÈý·½MsSqlDump¹¤¾ßÉú³Ésql²¢µ¼Èë¡£
ÊÊÓ÷¶Î§£ºÃ»Óд´½¨Êý¾Ý¿âµÄsql½Å±¾£¬µ«ÊÇÓÐÕýÔÚÔËÐеÄÊý¾Ý¿â
ÕâÖÖ±¸·Ý·½·¨£¬ÐèÒª½èÖúµÚÈý·½¹¤¾ß£ºMsSqlDump ¡£
Ê×ÏÈÔÚ±¾µØ¿ª·¢»·¾³ÉÏ£¬´ò¿ªMSSQLÆóÒµ¹ÜÀíÆ÷£¬ÕÒµ½ÕýÔÚÔËÐеÄÊý¾Ý¿â¡£ÀýÈçÒª¶Ô±¾ ......
<%
SQL1 = "update table1 set a=b where id=1"
Conn.ExeCute SQL1
SQL2 = "update table2 set a=b where id=2"
Conn.ExeCute SQL2
SQL3 = "update table3 set a=b where id=3"
Conn.ExeCute SQL3
%>
&nb ......
SQL Server Express 2005£¨ÒÔϼò³Æ SQLExpress£© ÊÇÓÉ΢Èí¹«Ë¾¿ª·¢µÄ SQL Server 2005£¨ÒÔϼò³Æ SQL2005£©µÄËõ¼õ°æ£¬Õâ¸ö°æ±¾ÊÇÃâ·ÑµÄ£¬Ëü¼Ì³ÐÁË SQL Server 2005 µÄ¶àÊý¹¦ÄÜÓëÌØÐÔ£¬È磺°²È«ÐÔÉèÖá¢×Ô¶¨Ò庯ÊýºÍ¹ý³Ì¡¢Transact-SQL¡¢SQL¡¢CLR µÈ£¬»¹Ãâ·ÑÌṩÁ˺ÍËüÅäÌ׵ĹÜÀíÈí¼þ SQL Server Management Studio Expre ......