ROWNUM in Oracle SQL
来源:互联网 发布:怎么在淘宝上开直播 编辑:程序博客网 时间:2024/06/09 21:06
rownum is a pseudo column. It numbers the records in a result set. The first record that meets the where criteria in a select statement is given rownum=1, and every subsequent record meeting that same criteria increases rownum.
After issuing a select statement, one of the last steps that oracle does is to assign an increasing (starting with 1, increased by 1) number to each row returned. The value of this row number can always be queried with rownum in a select statement:
select
rownum, column_1, column_2
from
table_1, table_2
where
field_3 = 'some value'
It is important to realize that the first row's rownum is always 1. This implies that the following query won't return a single row:
select
column_1, column_2
from
table_1, table_2
where
field_3 = 'some value'
and rownum > 5
This is so because the first row would have to meet the following two mutually excluding criterias:
- rownum is 1
- rownum is 6 (rownum > 5)
In order to do this query in the (probably) intended spirit, a sub-query must be executed:
select
column_1, column_2
from (
select
rownum r_, column_1, column_2
from
table_1, table_2
where
field_3 = 'some value'
)
where r_ > 5
- ROWNUM in Oracle SQL
- ROWNUM used in ORACLE
- 040908 Q SQL statement In SqlServer & Oracle --SELECT TOP 0 * FROM & ROWNUM = 0
- ORACLE rownum 和 SQL 外连接
- Oracle SQl语句----使用rownum分页
- 【SQL】——Oracle之ROWNUM
- oracle(rownum)
- oracle rownum
- oracle rownum
- Oracle ---rownum
- oracle rownum
- oracle rownum
- Oracle rownum
- oracle rownum
- oracle rownum
- Oracle rownum
- Oracle rownum
- oracle rownum
- java读取系统时间写入mysql数据库时,滞后八小时问题的解决 - ghostgarlic的专栏 - CSDNBlog
- 第一个15M
- 在普通的asp.net网站中使用ajax控件
- C++100题中的一些问题
- 反向进程注入及隐藏--动手做一个最简单的PELoader
- ROWNUM in Oracle SQL
- 获取WinNT/2K登陆密码(未打补丁前有效)
- pdg file的打开
- MySQL开始走上闭源道路?
- access 数据类型大全
- 找工作真的累了...
- WinForm UI设计与开发思路
- oracle 常用日期计算
- 在Mono中使用Linq