Oracle
中支持窗口函数
ROW_NUMBER()
,其用法和
MSSQLServer2005
中相同,比如我们
执行下面的
SQL
语句:
SELECT
*
FROM
(
SELECT
ROW_NUMBER() OVER(
ORDER BY
FSalary
DESC
) row_num,
FNumber,FName,FSalary,FAge
FROM
T_Employee
) a
WHERE
a.row_num>=
3
AND
a.row_num<=
5
ADD_MONTHS(FBirthDay,
2
),
Case 用法一:
SELECT
FName,
(
CASE
FName
WHEN
'Tom'
THEN
'GoodBoy'
WHEN
'Lily'
THEN
'GoodGirl'
WHEN
'Sam'
THEN
'BadBoy'
WHEN
'Kerry'
THEN
'BadGirl'
ELSE
'Normal'
END
)
as
isgood
FROM
T_Person
CASE
WHEN condition1 THEN returnvalue1
WHEN condition 2 THEN returnvalue2
WHEN condition 3 THEN returnvalue3
……
ELSE defaultreturnvalue
END