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

sqlÓÅ»¯34Ìõ

ÎÒÃÇÒª×öµ½²»µ«»áдSQL,»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄ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ʱ, »Ø¹ö¶Î²»ÔÙ´æ·ÅÈκοɱ»»Ö¸´µÄÐÅ


Ïà¹ØÎĵµ£º

Ó°ÏìSQL serverÐÔÄܵĹؼüÈý¸ö·½Ãæ

1 Âß¼­Êý¾Ý¿âºÍ±íµÄÉè¼Æ
Êý¾Ý¿âµÄÂß¼­Éè¼Æ¡¢°üÀ¨±íÓë±íÖ®¼äµÄ¹ØϵÊÇÓÅ»¯¹ØϵÐÍÊý¾Ý¿âÐÔÄܵĺËÐÄ¡£Ò»¸öºÃµÄÂß¼­Êý¾Ý¿âÉè¼Æ¿ÉÒÔΪ
ÓÅ»¯Êý¾Ý¿âºÍÓ¦ÓóÌÐò´òÏÂÁ¼ºÃµÄ»ù´¡¡£
±ê×¼»¯µÄÊý¾Ý¿âÂß¼­Éè¼Æ°üÀ¨ÓöàµÄ¡¢ÓÐÏ໥¹ØϵµÄÕ­±íÀ´´úÌæºÜ¶àÁеij¤Êý¾Ý±í¡£ÏÂÃæÊÇһЩʹÓñê×¼»¯
±íµÄһЩºÃ´¦¡£
A:ÓÉÓÚ±íÕ­£¬Òò´Ë¿ÉÒÔʹŠ......

Oracle SQLÓÅ»¯¼¼ÇÉ

ÎÒ¾õµÃÖ÷ÒªÓ¦¸Ã´Ó5¸ö·½Ãæ½øÐе÷Õû£º
1.È¥µô²»±ØÒªµÄ´óÐͱíµÄÈ«±íɨÃè
2.»º´æСÐͱíµÄÈ«±íɨÃè
3.¼ìÑéÓÅ»¯Ë÷ÒýµÄʹÓÃ
4.¼ìÑéÓÅ»¯µÄÁ¬½Ó¼¼Êõ
5.¾¡¿ÉÄܼõÉÙÖ´Ðмƻ®µÄCost
ÏÖÔÚ¼òµ¥µÄ¾Ù¼¸¸öÀý×Ó
Where×Ó¾äÖÐÓГ!=”½«²»Ê¹ÓÃË÷Òý
select account_name from test where amount != 0  (²»Ê¹ÓÃ) ......

Ãâ·ÑµÄSQL Server¹¤¾ß¿ÉÄÜÈÃÄãµÄÉú»î±äµÃ¸üÇáËÉ

¸üУºÐµĶ«Î÷´Ó×îеĸüн«ÊǺìÉ«µÄ¡£
This list will grow as I find new tools.Õâ·ÝÃûµ¥½«³É³¤ÎªÎÒÕÒµ½ÐµĹ¤¾ß¡£ So if you know of some not on this list do post them in the comments.ËùÒÔ£¬Èç¹ûÄãÖªµÀһЩ²»ÔÚ´ËÃûµ¥ÖеÄÒâ¼ûºó×öËûÃÇ¡£
SQL Server Management Studio Add-in's SQL Server¹ÜÀí¹¤×÷ÊÒÍâ½ÓµÄ
......

sql server 2005 ѧϰ±Ê¼Ç

µÚÒ»Õ£ºÐÅÏ¢Ìåϵ½á¹¹Ô­Ôò
¸ù¾ÝÒÔÏÂ7¸öÏ໥ÒÀÀµµÄÊý¾Ý´æ´¢Ä¿±êÉè¼ÆºÍÆÀ¹ÀÈκÎÊý¾Ý´æ´¢£º
l  ¼òµ¥ÐÔ£»
l  ÓÐÓÃÐÔ
l  Êý¾ÝÍêÕûÐÔ
l  ÐÔÄÜ
l  ¿ÉÓÃÐÔ
l  ¿ÉÀ©Õ¹ÐÔ
l  °²È«ÐÔ
 
¼Ü¹¹Éè¼ÆÔ­Ôò
l  ±ÜÃâ¹ýÓÚ¸´ÔÓ
l  ¾«ÐÄÌôÑ¡¼ü
l  Ê÷Á¢¿ÉÑ¡Êý¾Ý
l  ÊµÏ ......

½â¾ö²¢Çå³ýSQL±»×¢Èë¶ñÒⲡ¶¾´úÂëµÄÓï¾ä

declare @t varchar(255),@c varchar(255)  
declare table_cursor cursor for select a.name,b.name   
from sysobjects a,syscolumns b ,systypes c   
where a.id=b.id and a.xtype='u'&n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ