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

ÐÔÄܲâÊÔÖ®£º»áÒýÆðÈ«±íɨÃèµÄ¼¸ÖÖSql

1.
      
Ä£ºý²éѯЧÂʺܵͣº
Ô­Òò£º
like
±¾ÉíЧÂʾͱȽϵͣ¬Ó¦¸Ã¾¡Á¿±ÜÃâ²éѯÌõ¼þʹÓÃ
like
£»¶ÔÓÚ
like ‘%...%’
£¨È«Ä£ºý£©ÕâÑùµÄÌõ¼þ£¬ÊÇÎÞ·¨Ê¹ÓÃË÷ÒýµÄ£¬È«±íɨÃè×ÔȻЧÂʺܵͣ»ÁíÍ⣬ÓÉÓÚÆ¥ÅäËã·¨µÄ¹Øϵ£¬Ä£ºý²éѯµÄ×ֶ㤶ÈÔ½´ó£¬Ä£ºý²éѯЧÂÊÔ½µÍ¡£
½â¾ö°ì·¨£ºÊ×ÏȾ¡Á¿±ÜÃâÄ£ºý²éѯ£¬Èç¹ûÒòΪҵÎñÐèÒªÒ»¶¨ÒªÊ¹ÓÃÄ£ºý²éѯ£¬ÔòÖÁÉÙ±£Ö¤²»ÒªÊ¹ÓÃÈ«Ä£ºý²éѯ£¬¶ÔÓÚÓÒÄ£ºý²éѯ£¬¼´
like ‘…%’
£¬ÊÇ»áʹÓÃË÷ÒýµÄ£»×óÄ£ºý
like
‘%...’
ÎÞ·¨Ö±½ÓʹÓÃË÷Òý£¬µ«¿ÉÒÔ
ÀûÓÃreverse + function index
µÄÐÎʽ£¬±ä»¯³É like
‘…%’
£»È«Ä£ºýÊÇÎÞ·¨ÓÅ»¯µÄ£¬Ò»¶¨ÒªµÄ»°¿¼ÂÇÓÃËÑË÷ÒýÇæ¡£³öÓÚ½µµÍÊý¾Ý¿â·þÎñÆ÷µÄ¸ºÔØ¿¼ÂÇ£¬¾¡¿ÉÄܵؼõÉÙÊý¾Ý¿âÄ£ºý²éѯ¡£
2.
      
²éѯÌõ¼þÖк¬ÓÐ
is null
µÄ
select
Óï¾äÖ´ÐÐÂý
Ô­Òò£º
Oracle 9i
ÖУ¬²éѯ×Ö¶Î
is null
ʱµ¥Ë÷ÒýʧЧ£¬ÒýÆðÈ«±íɨÃè¡£
½â¾ö·½·¨£º
SQL
Óï·¨ÖÐʹÓÃ
NULL
»áÓкܶàÂé·³£¬
×îºÃË÷ÒýÁж¼ÊÇNOT NULL
µÄ£»¶ÔÓÚis null
£¬¿ÉÒÔ½¨Á¢×éºÏË÷Òý£¬nvl(
×Ö¶Î,0),
¶Ô±íºÍË÷Òýanalyse
ºó£¬is null
²éѯʱ¿ÉÒÔÖØÐÂÆôÓÃË÷Òý²éÕÒ,
µ«ÊÇЧÂÊ»¹²»ÊÇÖµµÃ¿Ï¶¨£»is not null
ʱÓÀÔ¶²»»áʹÓÃË÷Òý¡£Ò»°ãÊý¾ÝÁ¿´óµÄ±í²»ÒªÓÃis null
²éѯ¡£
3.
      
²éѯÌõ¼þÖÐʹÓÃÁ˲»µÈÓÚ²Ù×÷·û£¨
<>
¡¢
!=
£©µÄ
select
Óï¾äÖ´ÐÐÂý
Ô­Òò£º
SQL
ÖУ¬²»µÈÓÚ²Ù×÷·û»áÏÞÖÆË÷Òý£¬ÒýÆðÈ«±íɨÃ裬¼´Ê¹±È½ÏµÄ×Ö¶ÎÉÏÓÐË÷Òý
½â¾ö·½·¨£ºÍ¨¹ý°Ñ²»µÈÓÚ²Ù×÷·û¸Ä³É
or
£¬¿ÉÒÔʹÓÃË÷Òý£¬±ÜÃâÈ«±íɨÃè¡£ÀýÈ磬°Ñ
column<>’aaa’
£¬¸Ä³É
column<’aaa’ or column>’aaa’
£¬¾Í¿ÉÒÔʹÓÃË÷ÒýÁË¡£
6.
ʹÓÃ×éºÏË÷Òý£¬Èç¹û²éѯÌõ¼þÖÐûÓÐÇ°µ¼ÁУ¬ÄÇôË÷Òý²»Æð×÷Ó㬻áÒýÆðÈ«±íɨÃ裻µ«ÊÇ´ÓOracle9i
¿ªÊ¼£¬ÒýÈëÁËË÷ÒýÌøԾʽɨÃèµÄÌØÐÔ£¬¿ÉÒÔÔÊÐíÓÅ»¯Æ÷ʹÓÃ×éºÏË÷Òý£¬¼´±ãË÷ÒýµÄÇ°µ¼ÁÐûÓгöÏÖÔÚWHERE
×Ó¾äÖС£ÀýÈ磺create index skip1 on emp5(job,empno);  
È«Ë÷ÒýɨÃè select count(*) from emp5 where empno=7900;  
Ë÷ÒýÌøԾʽɨÃè select /*+ index(emp5 skip1)*/ count(*) from emp5 where empno=7900;
Ç°Ò»ÖÖÊÇÈ«±íɨÃ裬ºóÒ»ÖÖÔò»áʹÓÃ×


Ïà¹ØÎĵµ£º

sql_ÉèÖÃȨÏÞ_Êý¾Ý¿â»ù´¡

ÉèÖÃȨÏÞ
²»ÂÛÓû§»ò½ÇÉ«£¬¶¼ÊÇȨÏÞµÄÉèÖöÔÏó¡£³ýÁËÓ¦ÓóÌÐò½ÇÉ«½ÏÌØÊ⣬ÓëÆäËû½ÇÉ«¼°ÓÃ
»§ÓÐÏ໥Åųâ¹ØϵÍ⣬Êý¾Ý¿â½ÇÉ«¼°³ÉÔ±ÔÚȨÏ޵ĹØϵÉϷdz£ÃÜÇС£Ò»¸öÓû§¿ÉÄÜͬʱÁ¥
ÊôÓÚ¶à¸öÊý¾Ý¿â½ÇÉ«£¬Ã¿Ò»½ÇÉ«ÓÖ¿ÉÓµÓв»Í¬È¨ÏÞ£¬´ËʱÓû§»ñȡʵ¼ÊȨÏÞµÄÔ­ÔòÊÇ“²¢
¼¯”£¬³ý·ÇÓÐ deny£¨½ûÖ¹£©µÄÉèÖá£Èç½ÇÉ« A ½ ......

sql ²Ù×÷

 exec   sp_rename   't_2.lname','lastname','column' 
exec   sp_rename   ‘tabelname’,'new'
 
»ñµÃsqlÓï¾äµÄÖ´ÐÐʱ¼ä£º
SET STATISTICS TIME ON
// sql Óï¾ä£ºselect * from table
SET STATISTICS TIME OFF
 
 
´´½¨Ë÷Òý£ºCRE ......

¶ÁÈ¡ExcelÊý¾Ýµ½SQLÊý¾Ý¿â

±¾ÎÄʵÏÖÔÚc#ÖпɸßЧµÄ½«excelÊý¾Ýµ¼Èëµ½sqlserverÊý¾Ý¿âÖÐ,ºÜ¶àÈËͨ¹ýÑ­»·À´Æ´½Ósql£¬ÕâÑù×ö²»µ«ÈÝÒ׳ö´í¶øÇÒЧÂʵÍÏ£¬×îºÃµÄ°ì·¨ÊÇʹÓÃbcp£¬Ò²¾ÍÊÇSystem.Data.SqlClient.SqlBulkCopy ÀàÀ´ÊµÏÖ¡£²»µ«Ëٶȿ죬¶øÇÒ´úÂë¼òµ¥£¬ÏÂÃæ²âÊÔ´úÂëµ¼ÈëÒ»¸ö6Íò¶àÌõÊý¾ÝµÄsheet£¬°üÀ¨¶ÁÈ¡£¨È«²¿¶ÁÈ¡±È½ÏÂý£©ÔÚÎҵĿª·¢»·¾³ÖÐÖ»ÐèÒª1 ......

SQL Server 2008ʵʩÓëά»¤

¿Î³Ì½éÉÜ
    SQL Server 2008ÊÇ΢ÈíµÄ×îÐÂÊý¾Ý¿âϵͳ,ÆäÔÚÔ­ÓÐSQL Server 2005µÄ»ù´¡ÉÏ,½øÐÐÁËÖØ´óµÄ¸Ä½ø¡£±¾¿Î³Ì½«´Óά»¤Ó뿪·¢Á½¸ö·½Ãæ½øÐнÏϵͳµØ½²Êö£¬Ê¹Ñ§Ô±Äܹ»ÊìÁ·Ê¹ÓÃSQL Server 2008¿ª·¢Ç¿½¡µÄÊý¾Ý¿âÓ¦Óá£
Êʺ϶ÔÏó
Êý¾Ý¿â¹ÜÀí»ò¿ª·¢ÈËÔ±
¿Î³Ì³¤¶È
     & ......

SQL SERVERÓëACCESS,EXCELµÄÊý¾Ýת»»

ÊìϤSQL SERVER 2000µÄÊý¾Ý¿â¹ÜÀíÔ±¶¼ÖªµÀ£¬ÆäDTS¿ÉÒÔ½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬Æäʵ£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃTransact-SQLÓï¾ä½øÐе¼Èëµ¼³ö²Ù×÷¡£ÔÚTransact-SQLÓï¾äÖУ¬ÎÒÃÇÖ÷ҪʹÓÃOpenDataSourceº¯Êý¡¢OPENROWSET º¯Êý£¬¹ØÓÚº¯ÊýµÄÏêϸ˵Ã÷£¬Çë²Î¿¼SQLÁª»ú°ïÖú¡£ÀûÓÃÏÂÊö·½·¨£¬¿ÉÒÔÊ®·ÖÈÝÒ×µØʵÏÖSQL SERVER¡¢ACCESS¡¢EXCELÊý¾Ýת»»£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ