ÅäËÍÒѵ½»õ¶©µ¥ºÅ²éѯ 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×¢Èëʽ¹¥»÷µÄ½¨Òé
http://blog.csdn.net/jefflam/archive/2009/06/01/4233359.aspx
SQL×¢Èë¹¥»÷µÄΣº¦ÐԺܴó¡£ÔÚ½²½âÆä·ÀÖ¹°ì·¨Ö®Ç°£¬Êý¾Ý¿â¹ÜÀíÔ±ÓбØÒªÏÈÁ˽âÒ»ÏÂÆä¹¥»÷µÄÔÀí¡£ÕâÓÐÀûÓÚ¹ÜÀíÔ±²ÉÈ¡ÓÐÕë¶ÔÐԵķÀÖδëÊ©¡£
¡¡¡¡Ò»¡¢ SQL×¢Èë¹¥»÷µÄ¼òµ¥Ê¾Àý¡£
¡¡¡¡statement := "SELECT * from Users WHERE Va ......
v$sqltext
´æ´¢µÄÊÇÍêÕûµÄSQL
v$sqlarea
´æ´¢µÄSQL ºÍһЩÏà¹ØµÄÐÅÏ¢£¬±ÈÈçÀۼƵÄÖ´ÐдÎÊý£¬Âß¼¶Á£¬ÎïÀí¶ÁµÈͳ¼ÆÐÅÏ¢
v$sql
´æ´¢µÄÊǾßÌåµÄSQL ºÍÖ´Ðмƻ®Ïà¹ØÐÅÏ¢£¬Êµ¼ÊÉÏ£¬v$sqlarea ¿ÉÒÔ¿´×ö v$sql ¸ù¾Ý sqltext µÈ ×öÁË group by Ö®ºóµÄÐÅÏ¢ ......
±í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 ......
ͨ³££¬ÄãÐèÒª»ñµÃµ±Ç°ÈÕÆںͼÆËãһЩÆäËûµÄÈÕÆÚ£¬ÀýÈ磬ÄãµÄ³ÌÐò¿ÉÄÜÐèÒªÅжÏÒ»¸öÔµĵÚÒ»Ìì»òÕß×îºóÒ»Ìì¡£´ó²¿·ÖÈË´ó¸Å¶¼ÖªµÀÔõÑù°ÑÈÕÆÚ½øÐзָÄê¡¢Ô¡¢Èյȣ©£¬È»ºó½ö½öÓ÷ָî³öÀ´µÄÄê¡¢Ô¡¢ÈյȷÅÔÚ¼¸¸öº¯ÊýÖмÆËã³ö×Ô¼ºËùÐèÒªµÄÈÕÆÚ£¡ÔÚÕâƪÎÄÕÂÀÎÒ½«½ÌÄãÈçºÎʹÓÃDATEADDºÍDATEDIFFº¯ÊýÀ´¼ÆËã³öÔÚÄãµÄ³ÌÐòÖпÉÄÜÄ ......
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 ......