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

SQL Óï¾äÓÅ»¯(¸öÈËժ¼)

£¨1£©Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º 
ORACLE µÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£Èç¹ûÓÐ3¸öÒÔÉϵıíÁ¬½Ó²éѯ, ÄǾÍÐèҪѡÔñ½»²æ±í(intersection table)×÷Ϊ»ù´¡±í, ½»²æ±íÊÇÖ¸ÄǸö±»ÆäËû±íËùÒýÓõıí. 
£¨2£© WHERE×Ó¾äÖеÄÁ¬½Ó˳Ðò£®£º 
ORACLE²ÉÓÃ×Ô϶øÉϵÄ˳Ðò½âÎöWHERE×Ó¾ä,¸ù¾ÝÕâ¸öÔ­Àí,±íÖ®¼äµÄÁ¬½Ó±ØÐëдÔÚÆäËûWHEREÌõ¼þ֮ǰ, ÄÇЩ¿ÉÒÔ¹ýÂ˵ô×î´óÊýÁ¿¼Ç¼µÄÌõ¼þ±ØÐëдÔÚWHERE×Ó¾äµÄĩβ. 
£¨3£© SELECT×Ó¾äÖбÜÃâʹÓà ‘ * ‘£º 
ORACLEÔÚ½âÎöµÄ¹ý³ÌÖÐ, »á½«'*' ÒÀ´Îת»»³ÉËùÓеÄÁÐÃû, Õâ¸ö¹¤×÷ÊÇͨ¹ý²éѯÊý¾Ý×ÖµäÍê³ÉµÄ, ÕâÒâζ׎«ºÄ·Ñ¸ü¶àµÄʱ¼ä 
£¨4£©¼õÉÙ·ÃÎÊÊý¾Ý¿âµÄ´ÎÊý£º 
ORACLEÔÚÄÚ²¿Ö´ÐÐÁËÐí¶à¹¤×÷: ½âÎöSQLÓï¾ä, ¹ÀËãË÷ÒýµÄÀûÓÃÂÊ, °ó¶¨±äÁ¿ , ¶ÁÊý¾Ý¿éµÈ£» 
£¨5£©      ÔÚSQL*Plus , SQL*FormsºÍPro*CÖÐÖØÐÂÉèÖÃARRAYSIZE²ÎÊý, ¿ÉÒÔÔö¼Óÿ´ÎÊý¾Ý¿â·ÃÎʵļìË÷Êý¾ÝÁ¿ ,½¨ÒéֵΪ200 
£¨6£©Ê¹ÓÃDECODEº¯ÊýÀ´¼õÉÙ´¦Àíʱ¼ä£º 
ʹÓÃDECODEº¯Êý¿ÉÒÔ±ÜÃâÖظ´É¨ÃèÏàͬ¼Ç¼»òÖظ´Á¬½ÓÏàͬµÄ±í. 
£¨7£©ÕûºÏ¼òµ¥,ÎÞ¹ØÁªµÄÊý¾Ý¿â·ÃÎÊ£º 
Èç¹ûÄãÓм¸¸ö¼òµ¥µÄÊý¾Ý¿â²éѯÓï¾ä,Äã¿ÉÒÔ°ÑËüÃÇÕûºÏµ½Ò»¸ö²éѯÖÐ(¼´Ê¹ËüÃÇÖ®¼äûÓйØϵ) 
£¨8£©É¾³ýÖظ´¼Ç¼£º 
×î¸ßЧµÄɾ³ýÖظ´¼Ç¼·½·¨ ( ÒòΪʹÓÃÁËROWID)Àý×Ó£º 
DELETE from EMP E WHERE E.ROWID > (SELECT MIN(X.ROWID)
from EMP X WHERE X.EMP_NO = E.EMP_NO);
£¨9£©ÓÃTRUNCATEÌæ´úDELETE£º 
µ±É¾³ý±íÖеļǼʱ,ÔÚͨ³£Çé¿öÏÂ, »Ø¹ö¶Î(rollback segments ) ÓÃÀ´´æ·Å¿ÉÒÔ±»»Ö¸´µÄÐÅÏ¢. Èç¹ûÄãûÓÐCOMMITÊÂÎñ,ORACLE»á½«Êý¾Ý»Ö¸´µ½É¾³ý֮ǰµÄ״̬(׼ȷµØ˵Êǻָ´µ½Ö´ÐÐɾ³ýÃüÁî֮ǰµÄ×´¿ö) ¶øµ±ÔËÓÃTRUNCATEʱ, »Ø¹ö¶Î²»ÔÙ´æ·ÅÈκοɱ»»Ö¸´µÄÐÅÏ¢.µ±ÃüÁîÔËÐкó,Êý¾Ý²»Äܱ»»Ö¸´.Òò´ËºÜÉÙµÄ×ÊÔ´±»µ÷ÓÃ,Ö´ÐÐʱ¼äÒ²»áºÜ¶Ì. (ÒëÕß°´: TRUNCATEÖ»ÔÚɾ³ýÈ«±íÊÊÓÃ,TRUNCATEÊÇDDL²»ÊÇDML) 
£¨10£© ¾¡Á¿¶àʹÓÃCOMMIT£º 
Ö»ÒªÓпÉÄÜ,ÔÚ³ÌÐòÖо¡Á¿¶àʹÓÃCOMMIT, ÕâÑù³ÌÐòµÄÐÔÄܵõ½Ìá¸ß,ÐèÇóÒ²»áÒòΪCOMMITËùÊͷŵÄ×ÊÔ´¶ø¼õÉÙ: 
COMMITËùÊͷŵÄ×ÊÔ´: 
a. »Ø¹ö¶ÎÉÏÓ


Ïà¹ØÎĵµ£º

·´°²×°Sql Server 2005

ͨ¹ý“Ìí¼Óɾ³ý³ÌÐò”Àï²¢²»ÄÜÍêȫɾ³ýSQlL server¡£
ͨ¹ýÏÂÃæµÄÃüÁÍêÈ«·´°²×°SQL server 2005
d:\Setup.exe 
/
qb REMOVE
=ALL
 INSTANCENAME
=<
InstanceName
>
ĬÈÏʵÀýµÄÃû×ÖÊÇMSSQLSERVER
ÒýÓÃÎÄÕµØÖ·£ºhttp://www.cnblogs.com/jvstudio/archive/2010/01/17/1650089.ht ......

ͨ¹ý×÷Òµ×Ô¶¯±¸·Ýsql server 2005Êý¾Ý¿â

ÔÚSQL Server 2005Êý¾Ý¿âÖÐʵÏÖ×Ô¶¯±¸·ÝµÄ¾ßÌå²½Öè:
1¡¢´ò¿ªSQL Server Management Studio
2¡¢Æô¶¯SQL Server´úÀí
3¡¢µã»÷×÷Òµ->н¨×÷Òµ
4¡¢"³£¹æ"ÖÐÊäÈë×÷ÒµµÄÃû³Æ
5¡¢Ð½¨²½Ö裬ÀàÐÍÑ¡T-SQL£¬ÔÚÏÂÃæµÄÃüÁîÖÐÊäÈëÏÂÃæÓï¾ä£¨ºìÉ«²¿·ÖÒª¸ù¾Ý×Ô¼ºµÄʵ¼ÊÇé¿ö¸ü¸Ä£¬'D:\LMS2.0\LMS2.0\bak\' ¸ÄΪ×Ô¼ºµÄ±¸·Ý·¾¶£¬ ......

SQL SERVER convertº¯ÊýÈÕÆÚ¸ñʽ»¯Ó¦ÓÃ

Sql Server ÖÐÒ»¸ö·Ç³£Ç¿´óµÄÈÕÆÚ¸ñʽ»¯º¯Êý
¡¡¡¡Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
¡¡¡¡Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
¡¡¡¡Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16
¡¡¡¡Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06
¡¡¡¡Select ......

Çå³ýSQLÊý¾Ý¿âÈÕÖ¾Îļþ


Çå³ýSQLÊý¾Ý¿âÈÕÖ¾Îļþ
/*--ѹËõÊý¾Ý¿âµÄͨÓô洢¹ý³Ì
ÓÐÁ½ÖÖ·½·¨ Ò»ÊÇѹËõÈÕÖ¾£¬¶þÊÇɾ³ýÈÕÖ¾¡£
Ò»¡¢Ñ¹ËõÈÕÖ¾¼°Êý¾Ý¿âÎļþ´óС
ÒòΪҪ¶ÔÊý¾Ý¿â½øÐзÖÀë´¦Àí
ËùÒÔ´æ´¢¹ý³Ì²»ÄÜ´´½¨ÔÚ±»Ñ¹ËõµÄÊý¾Ý¿âÖÐ
/*--µ÷ÓÃʾÀý
exec p_compdb 'test'
--*/
use master   --×¢Òâ,´Ë´æ´¢¹ý³ÌÒª½¨ÔÚmasterÊý¾Ý¿âÖÐ
go ......

OracleºÍSQL Server¡¢DB2Êý¾Ý¿â±È½Ï

¿ª·ÅÐÔ:
SQL Server   
    Ö»ÄÜÔÚwindows ÉÏÔËÐУ¬Ã»ÓÐË¿ºÁµÄ¿ª·ÅÐÔ£¬²Ù×÷ϵͳµÄϵͳµÄÎȶ¨¶ÔÊý¾Ý¿âÊÇÊ®·ÖÖØÒªµÄ¡£Windows9XϵÁвúÆ·ÊÇÆ«ÖØÓÚ×ÀÃæÓ¦Óã¬NT serverÖ»ÊʺÏÖÐСÐÍÆóÒµ¡£¶øÇÒwindowsƽ̨µÄ¿É¿¿ÐÔ£¬°²È«ÐÔºÍÉìËõÐÔÊǷdz£ÓÐÏ޵ġ£Ëü²»ÏóunixÄÇÑù¾Ã¾­¿¼Ñ飬ÓÈÆäÊÇÔÚ´¦Àí´óÊý¾ÝÁ¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ