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

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 ÊôÐÔ·µ»ØµÄÖµÏ


Ïà¹ØÎĵµ£º

Oracle SQL LoaderµÄÏêϸÓï·¨

Oracle
SQL
Loader
µÄÏêϸÓï·¨
Oracle
   SQL
   Loader
µÄÏêϸÓï·¨
  
  SQL
*LOADER
ÊÇ
ORACLE
µÄÊý¾Ý¼ÓÔع¤¾ß£¬Í¨³£ÓÃÀ´½«²Ù×÷ϵͳÎļþǨÒƵ½
ORACLE
Êý¾Ý¿âÖС£
SQL
*LOADER
ÊÇ´óÐÍÊý¾Ý
  
 
²Ö¿âÑ¡ÔñʹÓõļÓÔØ·½·¨£¬ÒòΪËüÌṩÁË×î¿ì ......

Sql Server»ù±¾º¯Êý

Ô­ÎĵØÖ·£ºhttp://www.programfan.com/article/2597.html
1.×Ö·û´®º¯Êý
³¤¶ÈÓë·ÖÎöÓÃ
datalength(Char_expr) ·µ»Ø×Ö·û´®°üº¬×Ö·ûÊý,µ«²»°üº¬ºóÃæµÄ¿Õ¸ñ
substring(expression,start,length) ²»¶à˵ÁË,È¡×Ó´®
right(char_expr,int_expr) ·µ»Ø×Ö·û´®ÓÒ±ßint_expr¸ö×Ö·û
×Ö·û²Ù×÷Àà
upper(char_expr) תΪ´óд
lower(c ......

sql ´óÁ¿Êý¾Ý²éѯµÄ ÓÅ»¯´ëÊ©

¿´µ½µÄһƪ¹ØÓÚÊý¾Ý¿âÓÅ»¯µÄÎÄÕ£¬¾õµÃ¶Ô×Ô¼ºÓаïÖú£¬¾ÍתÌûµ½ÕâÀιʶø֪У¡    
    
  ÓÅ»¯Êý¾Ý¿âµÄ˼Ïë¼°SQLÓï¾äÓÅ»¯µÄÔ­Ôò   [תÌù   2005-08-18   14:20:05   ]   ·¢±íÕß:   chilizy        
    ......

sql²éѯÓï¾äÖÐ inºÍ existsµÄÇø±ðÓëÐÔÄܱȽÏ

¶ÔInºÍexistsµÄÐÔÄܽøÐбȽϣ¬Ê×ÏÈÒªÖªµÀËüÃÇÁ½ÕßµÄÇø±ð¡£
in: È·¶¨¸ø¶¨µÄÖµÊÇ·ñÓë×Ó²éѯÖеÄÖµ»òÁбíÖеÄÖµÏàÆ¥Åä¡£
exists: Ö¸¶¨Ò»¸ö×Ó²éѯ£¬¼ì²âÐÐÊÇ·ñ´æÔÚ¡£
¿É·ÖÎöËüÃǵIJéѯÓï¾äÀ´µÃ³öÕæʵµÄ²î±ð:
in
±ÈÈçSelect * from t1 where x in ( select y from t2 )
Ö´ÐеĹý³ÌÏ൱ÓÚ:
select *
  from t1, ( ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ