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

ÅäËÍÒѵ½»õ¶©µ¥ºÅ²éѯ sql Óï¾äÓÅ»¯

select c0501 "¶©µ¥±àºÅ",
   c0503 "¹©Ó¦É̱àÂë",a0302 "¹©Ó¦ÉÌÃû³Æ",
   to_char(c0515,'yyyy.mm.dd') "¶©»õÈÕÆÚ",
   to_char(c0516,'yyyy.mm.dd') "Ô¤¶¨½»»õÈÕÆÚ"
   from c05,a03 where c0503=a0301 and
   c0502='01' and to_char(c0515,'yyyy.mm.dd')
   between '2009.02.01' and '2009.02.28' and c0523='4'
SELECT STATEMENT, GOAL = CHOOSE            Cost=500    Cardinality=1059   
Bytes=69894
 HASH JOIN            Cost=500    Cardinality=1059    Bytes=69894
  TABLE ACCESS FULL    Object owner=FZDC    Object name=C05    Cost=486   
Cardinality=23    Bytes=667
  TABLE ACCESS FULL    Object owner=FZDC    Object name=A03    Cost=13    Cardinality=15193   
Bytes=562141
-------------------------1.75
-------------------------1.75
-------------------------1.75
    create index IND_C05_C0515 on c05(c0515)
    analyze table c05 compute statistics
select c0501 "¶©µ¥±àºÅ",
   c0503 "¹©Ó¦É̱àÂë",a0302 "¹©Ó¦ÉÌÃû³Æ",
   to_char(c0515,'yyyy.mm.dd') "¶©»õÈÕÆÚ",
   to_char(c0516,'yyyy.mm.dd') "Ô¤¶¨½»»õÈÕÆÚ"
   from c05,a03 where c0503=a0301 and
   c0502='01' and c0515
   between to_date('2009.02.01','yyyy-mm-dd') and to_date('2009.02.28','yyyy-mm-dd')
    and c0523='4'
  SQL Statement from editor:
  
  
   select c0501 "¶©µ¥±àºÅ",
     c0503 "¹©Ó¦É̱àÂë",a0302 "¹©Ó¦ÉÌÃû³Æ",
     to_ch


Ïà¹ØÎĵµ£º

Áù¸ö·ÀÖ¹SQL×¢Èëʽ¹¥»÷µÄ½¨Òé

Áù¸ö·ÀÖ¹SQL×¢Èëʽ¹¥»÷µÄ½¨Òé
http://blog.csdn.net/jefflam/archive/2009/06/01/4233359.aspx
SQL×¢Èë¹¥»÷µÄΣº¦ÐԺܴó¡£ÔÚ½²½âÆä·ÀÖ¹°ì·¨Ö®Ç°£¬Êý¾Ý¿â¹ÜÀíÔ±ÓбØÒªÏÈÁ˽âÒ»ÏÂÆä¹¥»÷µÄÔ­Àí¡£ÕâÓÐÀûÓÚ¹ÜÀíÔ±²ÉÈ¡ÓÐÕë¶ÔÐԵķÀÖδëÊ©¡£
¡¡¡¡Ò»¡¢ SQL×¢Èë¹¥»÷µÄ¼òµ¥Ê¾Àý¡£
¡¡¡¡statement := "SELECT * from Users WHERE Va ......

v$sql,v$sqlarea,v$sqltextÓÐʲôÇø±ð

v$sqltext
´æ´¢µÄÊÇÍêÕûµÄSQL
v$sqlarea
´æ´¢µÄSQL ºÍһЩÏà¹ØµÄÐÅÏ¢£¬±ÈÈçÀۼƵÄÖ´ÐдÎÊý£¬Âß¼­¶Á£¬ÎïÀí¶ÁµÈͳ¼ÆÐÅÏ¢
v$sql
´æ´¢µÄÊǾßÌåµÄSQL ºÍÖ´Ðмƻ®Ïà¹ØÐÅÏ¢£¬Êµ¼ÊÉÏ£¬v$sqlarea ¿ÉÒÔ¿´×ö v$sql ¸ù¾Ý sqltext µÈ ×öÁË group by Ö®ºóµÄÐÅÏ¢ ......

Ãû´ÎËã·¨(sql server)(ת×Ô£º°®Ð¾õÂÞ.ع»ª)

±íjh03ÓÐÏÂÁÐÊý¾Ý£º
name¡¡score
aa¡¡¡¡99
bb¡¡¡¡56
cc¡¡¡¡56
dd¡¡¡¡77
ee¡¡¡¡78
ff¡¡¡¡76
gg¡¡¡¡78
ff¡¡¡¡50
1. Ãû´ÎÉú³É·½Ê½1,ScoreÖظ´Ê±ºÏ²¢Ãû´Î
SELECT *¡¡,¡¡Place=(SELECT COUNT(DISTINCT Score) from jh03 WHERE Score >= a.Score)
from jh03 a
ORDER BY Place
½á¹û
Name Score Pla ......

SQL ServerÖÐDATAADDºÍDATADIFFµÄÓ÷¨

ͨ³££¬ÄãÐèÒª»ñµÃµ±Ç°ÈÕÆںͼÆËãһЩÆäËûµÄÈÕÆÚ£¬ÀýÈ磬ÄãµÄ³ÌÐò¿ÉÄÜÐèÒªÅжÏÒ»¸öÔµĵÚÒ»Ìì»òÕß×îºóÒ»Ìì¡£´ó²¿·ÖÈË´ó¸Å¶¼ÖªµÀÔõÑù°ÑÈÕÆÚ½øÐзָÄê¡¢Ô¡¢Èյȣ©£¬È»ºó½ö½öÓ÷ָî³öÀ´µÄÄê¡¢Ô¡¢ÈյȷÅÔÚ¼¸¸öº¯ÊýÖмÆËã³ö×Ô¼ºËùÐèÒªµÄÈÕÆÚ£¡ÔÚÕâƪÎÄÕÂÀÎÒ½«½ÌÄãÈçºÎʹÓÃDATEADDºÍDATEDIFFº¯ÊýÀ´¼ÆËã³öÔÚÄãµÄ³ÌÐòÖпÉÄÜÄ ......

ÓÃSQLÈ¥³ý±íÖÐijÁеÄIdentiferÊôÐÔ

sp_configure 'allow updates', 1
GO
reconfigure with override
GO
update syscolumns set colstat = colstat & 0x0000
where id=object_id('±íÃû') and name='ÁÐÃû'
GO
sp_configure 'allow updates', 0  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ