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

oracle SQLÐÔÄÜÓÅ»¯

ÎÒÃÇÒª×öµ½²»µ«»áд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 2000°²×°Öظ´³öÏÖ¹ÒÆðÎÊÌâ½â¾ö°ì·¨

  ½ñÌì°²×°sql server2000.ϵͳÊÇXP professional¡£Ê×ÏÈÏÈ°²×°sqlserverÆóÒµ°æµÄ£¬Ö»ÄÜ°²×°¿Í»§¶Ë£»È»ºó°²×°sqlserver¿ª·¢°æ£¬¾Í ±»¹ÒÆð£¬Òò´ËÍøÉÏËÑÂÞÏà¹ØÐÅÏ¢¡£
1¡¢ Èô³öÏÖ¹ÒÆðºó£¬¿É°´ÏÂÁвÙ×÷½øÐУ¬±¾ÈËÒѾ­ÊÔÓùý£º
      ÔÚÔËÐд°¿ÚÊäÈëregedit£¬´ò¿ª×¢²á±í±à¼­Æ÷£¬ÔÚHKEY_LOCA ......

¾«ÃîSQLÓï¾äÊÕ¼¯

                                                    ¾«ÃîSQLÓï¾äÊÕ¼¯ 
1¡¢ËµÃ÷£º´´½¨Êý¾Ý¿âCREATE DATABASE database-name 2¡¢ËµÃ÷£ºÉ¾³ýÊý¾Ý¿âdrop database dbn ......

Excel±íÊý¾Ýµ¼ÈëSql ServerÊý¾Ý¿âÖÐ

C#¡¢ASP.NETÖн«Excel±íÖеÄÊý¾Ýµ¼Èëµ½Sql ServerÊý¾Ý¿âÖжÔÓ¦µÄ±íÖС£
ÕâÀïÎÒÃǽ«E:\test.xls
ÖÐSheet1
±íÖеÄÊý¾Ýµ¼Èëµ½testÊý¾Ý¿âÖеÄmy_test
±íÖС£
Èí¼þ£ºVS2005£¬SQL Server2000,
test.xlsÖÐSheet1±íÖÐÓÐÈý¸ö×ֶΣ¬±àºÅ¡¢Ãû³Æ¡¢±¸×¢¡£¾ßÌåÄÚÈÝÈçÏÂͼ¡£




1¡¢
Ê×ÏÈ£¬ÎÒÃÇÒ ......

ÈçºÎ¼ì²éSQL Server tempdbÆ¿¾±

---È·ÈÏ·ÖÅäÆ¿¾±
SELECT session_id,wait_duration_ms,resource_description
from sys.dm_os_waiting_tasks
WHERE wait_type LIKE 'PAGE%LATCH_%' AND
 resource_description LIKE '2:%'
 
 --²éѯtempdbÖе±Ç°Òý·¢×î¶à·ÖÅäºÍ»ØÊÕ²Ù×÷
 
 SELECT TOP 10
 t1.session_id
 ,t1. ......

SQL ±íËø

ÆäʵÄã¿ÉÒÔʹÓÃÊÂÎñ´¦Àí
  ±È·½ËµÔÚÒ»¸ö×Ö¶ÎÀïÃæÌí¼ÓÒ»¸öboolean µÄ×ֶε±ÄãÒª´¦Àí¸Ã×ֶεÄʱºò¾Í True ÄÄô±ðµÄÈ˶¼²»¿ÉÒÔ½øÐвÙ×÷
¡¡Èç¹ûÊÇFalse ÄÄô¾Í¿ÉÒÔ½øÐвÙ×÷¡«¡«ºÇ¿É¡«¡«ÎÒÊÇÕâÑùµÄ
¡¡¡¡²»¹ýÄã¿ÉÒÔ¿´¿´¡¡
¡¡SQLËø»úÖÆ
¡¡¡¡ÒÔÏÂÊÇÎÒÕÒµÄһЩÁÏ¡¡Èç¹ûÒªÀí½âSQLËø»úÖÆ ×îºÃ°ÑÏÂÀ´¿´ÍêŶ
ĬÈϵÄÊÂÎñ¸ôÀë¼ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ