sqlÓÅ»¯É¨Ã¤
1.oracleɨÃèµÄ˳ÐòΪ´Óϵ½ÉÏ£¬´ÓÓÒµ½×ó
ËùÒÔÎÒÃÇÒª¾¡¿ÉÄܵİÑÊý¾ÝÉٵıí·ÅÔÚºóÃ棬½»²æ±í·ÅÔÚºóÃ棬×îÄܹýÂ˵ÄÌõ¼þ·ÅÔÚºóÃæ
2.²»ÒªÔÚË÷ÒýÉÏʹÓüÆËãºÍnot²Ù×÷·û
Ë÷ÒýÒ»µ©²ÎÓë¼ÆËã»òʹÓÃÁËnot²Ù×÷·û£¬oracle½«»áºöÂÔÕâ¸öË÷Òý
3.¾¡Á¿Ê¹ÓÃinºÍand£¬¾¡Á¿±ÜÃâʹÓÃor£¬or»á²úÉú´óÁ¿µÄ¹ýÂË £¬Ö±½Óµ¼ÖÂÂß¼¶Á´óÁ¿Ôö¼Ó
4.±ØҪʱʹÓÃautotrace(sqlplusÖÐÓÐЧ£¬PL/SQLÖÐÎÞЧ)
ÃüÁset autotrace on;
¹æÔò£º¾¡Á¿¼õÉÙÂß¼¶Á£¬Ó¦¸Ã±ÜÃâÎïÀí¶Á£¬Ìá¸ß»º³åÇøÃüÖÐÂÊ £¬×îºÃ±£³ÖÔÚ95%ÒÔÉÏ¡£
recursive calls µÝ¹éµ÷ÓÃ
db block gets Êý¾Ý¿é¶ÁÈ¡
consistent gets Ò»ÖÂÐÔ¶ÁÈ¡
physical reads ÎïÀí¶ÁÈ¡
redo size ²úÉúµÄÖØ×öÈÕÖ¾´óС
Âß¼¶Á=consistent gets + db block gets
»º³åÇøÃüÖÐÂÊ=(Âß¼¶Á-ÎïÀí¶Á)/Âß¼¶Á
Ò»¸ö½ø³Ì¿ÉÄܶÔÒÔºóÄܹ»Êý¾Ý¿éÖжà¸ösession¡£
sqlÓÅ»¯×îÖس£ÓõÄÊÇ°ì·¨ÊÇ£ºÉóÊÓsqlÓï¾ä
Ò²¿ÉÒÔÖ´ÐÐÕâÌõsqlÀ´²éÕҷdz£ºÄ·Ñ¿Õ¼äµÄsql£º
select sql_text ,sharable_mem from v$sql where sharable_mem > '100000' order by sharable_mem ;
Ïà¹ØÎĵµ£º
select 1 from ...£¬ sqlÓï¾äÖеÄ1´ú±íʲôÒâ˼£¿²é³öÀ´ÊǸöʲô½á¹û£¿
select 1 from table;Óëselect anycol(Ä¿µÄ±í¼¯ºÏÖеÄÈÎÒâÒ»ÐУ© from table;Óëselect * from table ´Ó×÷ÓÃÉÏÀ´ËµÊÇûÓвî±ðµÄ£¬¶¼ÊDz鿴ÊÇ·ñÓмǼ£¬Ò»°ãÊÇ×÷Ìõ¼þ²éѯÓõġ£select 1 from Ö ......
ÓÐÕâÑùÒ»¸ö×Ö·û´®(ÖÐ,¹ú,ÖÐ,ÈËÃñ,¹ú,ÏÖ´ú¹¤Òµ»¯½ø³Ì,¹ú)
´¦Àí¹ýÖ®ºó±ä³É(ÖÐ,¹ú,ÈËÃñ,ÏÖ´ú¹¤Òµ»¯½ø³Ì)
ÒÔÏÂÊÇÎҵķ½·¨,ÓÐʲô²»¶ÔµÄµØ·½»¹Çë¸÷λָµã
------------------ɾ³ýÖظ´µÄ×Ö·û
declare
@v1 nvarchar
......
SQL SERVER2000´ò²¹¶¡ÎÊÌâ»ã×Ü ¡¾http://hi.baidu.com/yanhai/blog/item/cf67c2ce07a9f50992457e9d.html¡¿
SQL ServerµÄ²¹¶¡°æ±¾¼ì²é²»ÈçWindows ²¹¶¡°æ±¾¼ì²éÖ±½Ó£¬Ò»¸öϵͳ¹ÜÀíÔ±£¬Èç¹û²»Á˽âSQL Server°æ±¾¶ÔÓ¦µÄ²¹¶¡ºÅ£¬¿ÉÄÜÒ²»áÓöµ½Ò»µãÂé·³£¬Òò´ËÔÚÕâ˵Ã÷һϣ¬Í¨¹ýÕâÑùµÄ°ì·¨Åбð»úÆ÷ÊÇ°²È«µÄ°ì·¨£¬²»»á¶Ôϵͳ²úÉúÈ ......
MS SQLµÄһЩ¾µä³£ÓòÙ×÷Óï¾ä»ã×Ü ¡¾http://hi.baidu.com/kychen88/blog/item/b3c8e7d960821b3c32fa1cee.html¡¿
1.°´ÐÕÊϱʻÅÅÐò:
Select * from TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as
2.Êý¾Ý¿â¼ÓÃÜ:
select encrypt('ÔʼÃÜÂë')
select pwdencrypt('ÔʼÃÜÂë')
select pwdcomp ......
selectÓï¾äÖÐÖ»ÄÜʹÓÃsqlº¯Êý¶Ô×ֶνøÐвÙ×÷£¨Á´½Ósql server£©£¬
select ×Ö¶Î1 from ±í1 where ×Ö¶Î1.IndexOf("ÔÆ")=1;
ÕâÌõÓï¾ä²»¶ÔµÄÔÒòÊÇindexof£¨£©º¯Êý²»ÊÇsqlº¯Êý£¬¸Ä³Ésql¶ÔÓ¦µÄº¯Êý¾Í¿ÉÒÔÁË¡£
left£¨£©ÊÇsqlº¯Êý¡£
select ×Ö¶Î1 from ±í1 where charindex£¨'ÔÆ',×Ö¶Î1£©=1;
×Ö·û´®º¯Êý¶Ô¶þ½øÖÆÊý¾Ý¡¢×Ö·û´®º ......