SQLite²»Ö§³ÖµÄSQLÓï·¨×ܽá
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] =
tag_rss.[tagid](*);
SELECT tags.[tagid] from [tags],[tag_rss] WHERE LEFT OUTER JOIN
tag_rss.[tagid] = tags.[tagid];
SELECT tags.[tagid] from [tags],[tag_rss] WHERE LEFT JOIN
tag_rss.[tagid] = tags.[tagid];
´ËÍâ¾¹ý²âÊÔÓÃ+ºÅ´úÌæ*ºÅÒ²ÊDz»¿ÉÐеġ£
ÊÕ¼¯SQLiteÓëSql ServerµÄÓï·¨²îÒì
1.·µ»Ø×îºó²åÈëµÄ±êʶֵ
·µ»Ø×îºó²åÈëµÄ±êʶֵsql serverÓÃ@@IDENTITY
sqliteÓñêÁ¿º¯ÊýLAST_INSERT_ROWID()
·µ»Øͨ¹ýµ±Ç°µÄ SQLConnection ²åÈëµ½Êý¾Ý¿âµÄ×îºóÒ»ÐеÄÐбêʶ·û£¨Éú³ÉµÄÖ÷¼ü£©¡£´ËÖµÓë
SQLConnection.lastInsertRowID ÊôÐÔ·µ»ØµÄÖµÏ
Ïà¹ØÎĵµ£º
SQLÈ¡ÈÕÆÚ
SQL Server 2009-11-19 15:07:30 ÔĶÁ7 ÆÀÂÛ0 ×ֺţº´óÖÐС
·½·¨Ò»:
select CONVERT(varchar, getdate(), 120 )
2004-09-12 11:06:08
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),\'-\',\'\'),\' \',\'\'),\':\',\'\')
20040912110608
select CONVERT(varchar(12) , getdate( ......
TITLE: SQL Server °²×°³ÌÐòʧ°Ü¡£
------------------------------
SQL Server °²×°³ÌÐòÓöµ½ÒÔÏ´íÎó:
MsiGetProductInfo ÎÞ·¨¼ìË÷ Product Code Ϊ“{95120000-00B9-0409-0000-0000000FF1CE}”µÄ°üµÄ ProductVersion¡£´íÎó´úÂë: 1605¡£¡£
Óöµ½Õâ¸ö´íÎóʱ£¬½â¾ö·½·¨ÈçÏ£º
µ±ÏµÍ³ÌáʾÈç {95120000-0 ......
¿´µ½µÄһƪ¹ØÓÚÊý¾Ý¿âÓÅ»¯µÄÎÄÕ£¬¾õµÃ¶Ô×Ô¼ºÓаïÖú£¬¾ÍתÌûµ½ÕâÀιʶø֪У¡
ÓÅ»¯Êý¾Ý¿âµÄ˼Ïë¼°SQLÓï¾äÓÅ»¯µÄÔÔò [תÌù 2005-08-18 14:20:05 ] ·¢±íÕß: chilizy
......
¶ÔInºÍexistsµÄÐÔÄܽøÐбȽϣ¬Ê×ÏÈÒªÖªµÀËüÃÇÁ½ÕßµÄÇø±ð¡£
in: È·¶¨¸ø¶¨µÄÖµÊÇ·ñÓë×Ó²éѯÖеÄÖµ»òÁбíÖеÄÖµÏàÆ¥Åä¡£
exists: Ö¸¶¨Ò»¸ö×Ó²éѯ£¬¼ì²âÐÐÊÇ·ñ´æÔÚ¡£
¿É·ÖÎöËüÃǵIJéѯÓï¾äÀ´µÃ³öÕæʵµÄ²î±ð:
in
±ÈÈçSelect * from t1 where x in ( select y from t2 )
Ö´ÐеĹý³ÌÏ൱ÓÚ:
select *
from t1, ( ......
΢ÈíµÄÊý¾Ý¿âÈÏÖ¤´Ó°üÀ¨3¸ö·½ÃæµÄ£º
MCTS: Microsoft Certified Technology Specialist
MCITP: Microsoft Certified IT Professional
MCM: Microfot Certified Master.
΢Èí½¨Òé²Î¼Ó×îа汾µÄÊý¾Ý¿âÈÏÖ¤¿¼ÊÔ£¬µ±Ç°°æ±¾ÊÇÖ¸Microsoft SQL Server 2008¡£
SQL Server2008 MCTS°üÀ¨3¸öÈÏÖ¤£º
1> SQL Server 200 ......