有这种函数么?
这样写,也可以吧。
select line,empno,ename,job
from (select empno,ename,job,rownum line from scott.emp)
where line in
(
select min(line)
from
(
select empno,ename,job,rownum line from scott.emp)
union
select max(line) from
(
select empno,ename,job,rownum line from scott.emp
)
)
这样写,也可以吧。
select line,empno,ename,job
from (select empno,ename,job,rownum line from scott.emp)
where line in
(
select min(line)
from
(
select empno,ename,job,rownum line from scott.emp)
union
select max(line) from
(
select empno,ename,job,rownum line from scott.emp
)
)
---------- ---------- -------------------- ------------------
1 7369 SMITH CLERK
12 7934 MILLER CLERK
-- -----------
1 2003-1-1
1 2003-2-6
1 2003-1-5SQL> select * from (select rownum rm,first_value(time) over(),last_value(time) over() from aaa) where rm=1; RM FIRST_VALUE(TIME)OVER() LAST_VALUE(TIME)OVER()
---------- ----------------------- ----------------------
1 2003-1-1 2003-1-5
enhydraboy(乱舞的浮尘) 的写法应该只能查到物理存储的第一条和最后一条记录
未必正确.
union
select * from emp where rowid =(select max(rowid) from emp)