SQL ServerºÍOracle³£Óú¯Êý¶Ô±È
Êýѧº¯Êý
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.Çó×Ö·ûÐòºÅ
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
Ê×ÏÈ£¬Ô ......
Case¾ßÓÐÁ½ÖÖ¸ñʽ¡£¼òµ¥Caseº¯ÊýºÍCaseËÑË÷º¯Êý¡£
--¼òµ¥Caseº¯Êý
CASE sex
WHEN '1' THEN 'ÄÐ'
WHEN '2' THEN 'Å®'
ELSE 'ÆäËû' END
--CaseËÑË÷º¯Êý
CASE WHEN sex = '1' THEN 'ÄÐ'
WHEN sex = '2' THEN 'Å®'
ELSE 'ÆäËû' END
ÕâÁ½ÖÖ·½Ê½£¬¿ÉÒÔʵÏÖÏàͬµÄ¹¦ÄÜ¡£¼òµ¥Caseº¯ÊýµÄд·¨Ïà ......
SQL½ØÈ¡×Ö·û´®
SUBSTRING
·µ»Ø×Ö·û¡¢binary¡¢text »ò image ±í´ïʽµÄÒ»²¿·Ö¡£ÓйؿÉÓë¸Ãº¯ÊýÒ»ÆðʹÓõÄÓÐЧMicrosoft SQL Server Êý¾ÝÀàÐ͵ĸü¶àÐÅÏ¢£¬Çë²Î¼ûÊý¾ÝÀàÐÍ¡£
Óï·¨
SUBSTRING ( expression & ......
Ò»¡¢ÄÚ²¿º¯Êý
1¡¢ÄÚ²¿ºÏ¼Æº¯Êý
1£©COUNT£¨*£© ·µ»ØÐÐÊý
2£©COUNT£¨DISTINCT COLNAME£©·µ»ØÖ¸¶¨ÁÐÖÐΨһֵµÄ¸öÊý
3£©SUM£¨COLNAME/EXPRESSION£©·µ»ØÖ¸¶¨Áлò±í´ïʽµÄÊýÖµºÍ£»
4£©SUM£¨DISTINCT COLNAME£© ·µ»ØÖ¸¶¨ÁÐÖÐΨһֵµÄºÍ
5£©AVG£¨COLNAME/EXPRESSION£©·µ»ØÖ¸¶¨Áлò±í´ïʽÖеÄÊýֵƽ¾ùÖµ
6£©AV ......