SQLiteÖв»Ö§³ÖµÄsqlÓï·¨
½ñÌìºÜ×ÔÈ»µÄÔÚдSqlÓï¾äµÄʱºòÓÃÁËTop£¬Ò»¿ªÊ¼Ã»·¢ÏÖÎÊÌ⣬ÒòΪÎÒ´ÓÊý¾Ý¿â¶Á³öµÄÖµÕýºÃÊÇ0£¬¶øÎÒÏ°¹ß±äÁ¿¶¨ÒåµÄʱºòÒ²¶¼¸³Öµ0£¬¿ÉÊǵ½ÎÒ²»Òª0µÄʱºòÎҾͷ¢ÏÖÎÊÌâÁË¡£ºóÀ´²ÅÖªµÀ£¬¿É°®µÄСsqlite¾¹È»Óв»Ö§³ÖµÄsqlÓï·¨¡£
¡¡¡¡¿´µ½Ä³¸öÂÛ̳ÓиöÐÂÊÖÒ²·¢ÏÖÁËÕâ¸öÎÊÌâ²¢·¢ÌûÁË£¬ÏÂÃæһţÈ˵Ļظ´ÊÇ“topÊÇÄļҵĹؼü´Ê?sqlite¼ÒûÓÐÕâ´ÊµÄ”£¬¹þ£¬ÔÀ´topÕâ´ÊÊÇmssqlÀï²ÅÓеÄ~
¡¡¡¡×îºó»¹Ïë˵£¬Êý¾Ý¿â¾ø¶ÔÊǺÜÖØÒªµÄÒ»¿é¡£ÎҵĻù´¡Óï·¨ºÜÀ¬»ø£¬¹ý¼¸ÌìÈÏÕæ¼Ç¼Ï¡£
¡¡¡¡Google֮ϵĽá¹û£º
1 TOP
¡¡¡¡ÕâÊÇÒ»¸ö´ó¼Ò¾³£Îʵ½µÄÎÊÌ⣬ÀýÈçÔÚSQLSERVERÖпÉÒÔʹÓÃÈçÏÂÓï¾äÀ´È¡µÃ¼Ç¼¼¯ÖеÄÇ°Ê®Ìõ¼Ç¼£º
¡¡¡¡SELECT TOP 10 * from [index] ORDER BY indexid DESC;
¡¡¡¡µ«ÊÇÕâÌõSQLÓï¾äÔÚSQLiteÖÐÊÇÎÞ·¨Ö´Ðеģ¬Ó¦¸Ã¸ÄΪ£º
¡¡¡¡SELECT * from [index] ORDER BY indexid DESC limit 0,10;
¡¡¡¡ÆäÖÐlimit 0,10±íʾ´ÓµÚ0Ìõ¼Ç¼¿ªÊ¼£¬ÍùºóÒ»¹²¶ÁÈ¡10Ìõ
2 ´´½¨ÊÓͼ£¨Create View£©
¡¡¡¡SQLiteÔÚ´´½¨¶à±íÊÓͼµÄʱºòÓÐÒ»¸öBUG£¬ÎÊÌâÈçÏ£º
¡¡¡¡CREATE VIEW watch_single AS SELECT DISTINCTwatch_item.[watchid],watch_item.[itemid] from watch_item;
¡¡¡¡ÉÏÃæÕâÌõSQLÓï¾äÖ´Ðкó»áÏÔʾ³É¹¦£¬µ«ÊÇʵ¼ÊÉϳýÁË
¡¡¡¡SELECT COUNT(*) from [watch_single ] WHERE watch_ single.watchid = 1;
¡¡¡¡ÄÜÖ´ÐÐÖ®ÍâÊÇÎÞ·¨Ö´ÐÐÆäËûÈκÎÓï¾äµÄ¡£ÆäÔÒòÔÚÓÚ½¨Á¢ÊÓͼµÄʱºòÖ¸¶¨ÁË×Ö¶ÎËùÔڵıíÃû£¬¶øSQLite²¢²»ÄÜÕýÈ·µØʶ±ðËü¡£ËùÒÔÉÏÃæµÄ´´½¨Óï¾äÒª¸ÄΪ£º
¡¡¡¡CREATE VIEW watch_single AS SELECT DISTINCT [watchid],[itemid] from watch_item;
¡¡¡¡µ«ÊÇËæÖ®¶øÀ´µÄÎÊÌâÊÇÈç¹ûÊǶà±íµÄÊÓͼ£¬ÇÒ±í¼äÓÐÖØÃû×ֶεÄʱºò¸ÃÔõô°ì£¿
3 COUNT£¨DISTINCT column£©
¡¡¡¡SQLiteÔÚÖ´ÐÐÈçÏÂÓï¾äµÄʱºò»á±¨´í£º
¡¡¡¡¡¡¡¡SELECT COUNT(DISTINCT watchid) from [watch_item] WHERE watch_item.watchid = 1;
¡¡¡¡¡¡¡¡ÆäÔÒòÊÇSQLiteµÄËùÓÐÄÚÖú¯Êý¶¼²»Ö§³ÖDISTINCTÏÞ¶¨£¬ËùÒÔÈç¹ûҪͳ¼Æ²»Öظ´µÄ¼Ç¼ÊýµÄʱºò»á³öÏÖһЩÂé·³¡£±È½Ï¿ÉÐеÄ×ö·¨ÊÇÏȽ¨Á¢Ò»¸ö²»Öظ´µÄ¼Ç¼±íµÄÊÓͼ£¬È»ºóÔÙ¶Ô¸ÃÊÓͼ½øÐмÆÊý¡£
4 ÍâÁ¬½Ó
¡¡¡¡ËäÈ»SQLite¹Ù·½ÒѾÉù³ÆLEFT OUTER JOIN ÒѾʵÏÖ£¬µ«»¹Ã»ÓÐ RIGHT OUTER JOIN ºÍ FULL OUTER JOIN¡£µ«ÊÇʵ¼Ê²âÊÔ±íÃ÷Ëƺõ²¢²»Äܹ»Õý³£µÄ¹¤×÷¡£ÒÔÏÂÈýÌõÓï¾äÔÚÖ´ÐеÄʱºò¾ù»á±¨´í£º
¡¡¡¡SELECT tags.[tagid] from [tags],[tag_rss] WHERE tags.[tagid]
Ïà¹ØÎĵµ£º
--SQL½âÃÜctext×Ö¶ÎÄÚÈݺ¯Êý
--exec sp_decrypt 'Ô¼ÊøÃû³Æ'
--exec sp_decrypt 'DF_InsuranceRecord_PeriodUnit'
--exec sp_decrypt '´æ´¢¹ý³ÌÃû³Æ'
--exec sp_decrypt 'sp_SearchPrinting_InsuranceRecord'
--Ö÷ÒªÓÃ;:¶ÁÈ¡systemcommentsÖеÄ×Ö¶ÎÄÚÈÝ¡£°üÀ¨Ô¼Êø,´æ´¢¹ý³ÌµÈµÈ¡£
--ÔÎÄÓ¦¸ÃÀ´×Ôhttp://blog.csdn.net ......
SQL´¥·¢Æ÷ʵÀý1
¶¨Ò壺 ºÎΪ´¥·¢Æ÷£¿ÔÚSQL ServerÀïÃæÒ²¾ÍÊǶÔijһ¸ö±íµÄÒ»¶¨µÄ²Ù×÷£¬´¥·¢Ä³ÖÖÌõ¼þ£¬´Ó¶øÖ´ÐеÄÒ»¶Î³ÌÐò¡£´¥·¢Æ÷ÊÇÒ»¸öÌØÊâµÄ´æ´¢¹ý³Ì¡£
³£¼ûµÄ´¥·¢Æ÷ÓÐÈýÖÖ£º·Ö±ðÓ¦ÓÃÓÚInsert , Update , Delete ʼþ¡£
ÎÒΪʲôҪʹÓô¥·¢Æ÷£¿±ÈÈ磬 ......
ÔÚwindows XP SP3 ÖÐÊÇ¿ÉÒÔ°²×° SQL Server 2005 µÄ²»»áÓмæÈÝÎÊÌâ ÎÒÔÚ°²×°µÄʱºò¾ÍʲôÎÊÌⶼû¿´µ½ °²×°ºÃºó¸½¼ÓÒ»¸öÊý¾Ý¿â ÓÃBorland JBuilder 2006 Enterprise ºÍeclipse ҲûÎÊÌâ
SQL2005 ·ÖÎå¸ö°æ±¾£¬ÈçÏÂËùÁУ¬
¡¡¡¡1.Enterprise(ÆóÒµ°æ),
2.Development(¿ª·¢°æ),
¡¡¡¡3.Workgroup,(¹¤×÷Ⱥ°æ)
¡¡¡¡4.St ......
Ò»¡¢´´½¨Ò»¸ö¼òµ¥µÄ´¥·¢Æ÷
´¥·¢Æ÷ÊÇÒ»ÖÖÌØÊâµÄ´æ´¢¹ý³Ì£¬ÀàËÆÓÚʼþº¯Êý£¬SQL Server? ÔÊÐíΪ INSERT¡¢UPDATE¡¢DELETE ´´½¨´¥·¢Æ÷£¬¼´µ±ÔÚ±íÖвåÈë¡¢¸üС¢É¾³ý¼Ç¼ʱ£¬´¥·¢Ò»¸ö»òһϵÁÐ T-SQLÓï¾ä¡£
´¥·¢Æ÷¿ÉÒÔÔÚ²éѯ·ÖÎöÆ÷Àï´´½¨£¬Ò²¿ÉÒÔÔÚ±íÃûÉϵãÓÒ¼ü->“ËùÓÐÈÎÎñ”->“¹ÜÀí´¥·¢Æ÷”À´´´½¨ ......
SQL Server Êý¾Ý¿â¹ÊÕÏÐÞ¸´¶¥¼¶¼¼ÇÉÖ®Ò»
2010-04-26 10:37:52 À´Ô´:TechTargetÖйú ÎÒÒªÊÕ²Ø
SQL Server 2005 ºÍ 2008 Óм¸¸ö¹ØÓڸ߿ÉÓÃÐÔµÄÑ¡ÏÈçÈÕÖ¾´«Êä¡¢¸±±¾ºÍÊý¾Ý¿â¾µÏñ¡£ËùÓÐÕâЩ¼¼Êõ¶¼Äܹ»×÷Ϊά»¤Ò»¸ö±¸Ó÷þÎñÆ÷µÄÊֶΣ¬Í¬Ê±Õâ¸öÊý¾Ý¿â¿ÉÒÔÔÚÄãÔÏȵÄÖ÷Êý¾Ý¿â³öÎÊÌâʱÉÏÏß²¢×÷ΪеÄÖ÷·þÎñÆ÷¡£È»¶ø£¬Äã± ......