SQL SEVERÓëORACLE µÄsqlÓï¾äÇø±ð
Êýѧº¯Êý£º
1.¾ø¶ÔÖµ
S:SELECT abs(-1) value
O:SELECT abs(-1) value from dual
2.È¡Õû(´ó)
S:SELECT ceiling(-1.001) value
O:SELECT ceil(-1.001) value from dual
3.È¡Õû£¨Ð¡£©
S:SELECT floor(-1.001) value
O:SELECT floor(-1.001) value from dual
4.È¡Õû£¨½ØÈ¡£©
S:SELECT cast(-1.002 as int) value
O:SELECT trunc(-1.002) value from dual
5.ËÄÉáÎåÈë
S:SELECT round(1.23456,4) value 1.23460
O:SELECT round(1.23456,4) value from dual 1.2346
6.eΪµ×µÄÃÝ
S:SELECT Exp(1) value 2.7182818284590451
O:SELECT Exp(1) value from dual 2.71828182
7.È¡eΪµ×µÄ¶ÔÊý
S:SELECT log(2.7182818284590451) value 1
O:SELECT ln(2.7182818284590451) value from dual; 1
8.È¡10Ϊµ×¶ÔÊý
S:SELECT log10(10) value 1
O:SELECT log(10,10) value from dual; 1
9.ȡƽ·½
S:SELECT SQUARE(4) value 16
O:SELECT power(4,2) value from dual 16
10.ȡƽ·½¸ù
S:SELECT SQRT(4) value 2
O:SELECT SQRT(4) value from dual 2
11.ÇóÈÎÒâÊýΪµ×µÄÃÝ
S:SELECT power(3,4) value 81
O:SELECT power(3,4) value from dual 81
12.È¡Ëæ»úÊý
S:SELECT rand() value
O:SELECT sys.dbms_random.value(0,1) value from dual;
13.È¡·ûºÅ
S:SELECT sign(-8) value -1
O:SELECT sign(-8) value from dual -1
14.Ô²ÖÜÂÊ
S:SELECT PI() value 3.1415926535897931
O:²»ÖªµÀ
15.sin,cos,tan ²ÎÊý¶¼ÒÔ»¡¶ÈΪµ¥Î»
ÀýÈ磺SELECT sin(PI()/2) value µÃµ½1£¨SQLServer£©
16.Asin,Acos,Atan,Atan2 ·µ»Ø»¡¶È
17.»¡¶È½Ç¶È»¥»»(SQLServer£¬Oracle²»ÖªµÀ)
DEGREES£º»¡¶È-¡µ½Ç¶È
RADIANS£º½Ç¶È-¡µ»¡¶È
ÊýÖµ¼ä±È½Ï£º
18. Ç󼯺Ï×î´óÖµ
S:SELECT max(value) value from
¡¡¡¡ (SELECT 1 value
¡¡¡¡ union
¡¡¡¡ SELECT -2 value
¡¡¡¡ union
¡¡¡¡ SELECT 4 value
¡¡¡¡ union
¡¡¡¡ SELECT 3 value)a
¡¡¡¡O:SELECT greatest(1,-2,4,3) value from dual
19. Ç󼯺Ï×îСֵ
S:SELECT min(value) value from
¡¡¡¡ (SELECT 1 value
¡¡¡¡ union
¡¡¡¡ SELECT -2 value
¡¡¡¡ union
¡¡¡¡ SELECT 4 value
¡¡¡¡ union
¡¡¡¡ SELECT 3 value)a
¡¡¡¡O:SELECT least(1,-2,4,3) value from dual
20.ÈçºÎ´¦ÀínullÖµ(F2ÖеÄnullÒÔ10´úÌæ)
S:SELECT F1,IsNull(F2,10) value from Tbl
O:SELECT F1,nvl(F2,10) value from Tbl
21.Çó
Ïà¹ØÎĵµ£º
1£©
#pragma warning(disable:4146)
#import "C:\Program Files\Common Files\System\ADO\msado15.dll"
named_guids rename("EOF","adoEOF"), rename("BOF","adoBOF")
#pragma warning(default:4146)
using namespace ADODB;
2£©
#pragma warning(disable:4146) ......
ÏîÄ¿ÖÐÓÐÉæ¼°´æ´¢¹ý³Ì¶Ô×Ö·û´®µÄ´¦Àí£¬ËùÒԾͽ«ÔÚÍøÉϲéÕÒµ½µÄ×ÊÁÏ»ã×Ü£¬×öÒ»¸öÐÅϢƴ½ÓʽµÄ×ܽᡣ
ÒÔÏÂÐÅÏ¢¾ùÀ´×Ô»¥ÁªÍø£¬Ìù³öÀ´Ò»Ôò×Ô¼º±£´æÒÔ´ýÒÔºóʹÓã¬Ò»Ôò¹©´ó¼Ò·ÖÏí¡£
×Ö·ûº¯Êý——·µ»Ø×Ö·ûÖµ
ÕâЩº¯ÊýÈ«¶¼½ÓÊÕµÄÊÇ×Ö·û×åÀàÐ͵IJÎÊý(CHR³ýÍâ)²¢ÇÒ·µ»Ø×Ö·ûÖµ.
³ýÁËÌرð˵Ã÷µÄÖ®Íâ,ÕâЩº¯Êý´ó²¿·Ö·µ» ......
ORACLEÈÕÆÚʱ¼äº¯Êý´óÈ«
TO_DATE¸ñʽ(ÒÔʱ¼ä:2007-11-02 13:45:25ΪÀý)
Year:
yy two digits Á½Î»Äê   ......
select t.OSUSER,t.STATUS,t.LOGON_TIME from v$session t
select t.OSUSER,t.STATUS,t.LOGON_TIME from v$session t where t.OSUSER='admin'
select t.OSUSER,t.STATUS,t.LOGON_TIME from v$session t where t.OSUSER='liuzhaoqing'
select t.OSUSER,t.STATUS,t.LOGON_TIME from v$session t where t.OSUSER='ymx'
sel ......
select * into destTbl from srcTbl
insert into destTbl(fld1, fld2) select fld1, 5 from srcTbl
ÒÔÉÏÁ½¾ä¶¼Êǽ« srcTbl µÄÊý¾Ý²åÈëµ½ destTbl£¬µ«Á½¾äÓÖÓÐÇø±ðµÄ£º
µÚÒ»¾ä£¨select into from£©ÒªÇóÄ¿±ê±í£¨destTbl£©²»´æÔÚ£¬ÒòΪÔÚ²åÈëʱ»á×Ô¶¯´´½¨¡£
µÚ¶þ¾ä£¨insert into select from£©ÒªÇóÄ¿±ê±í£¨dest ......