Home >Database >Oracle >How to query the first piece of data in oracle

How to query the first piece of data in oracle

WBOY
WBOYOriginal
2021-12-27 16:28:5433738browse

In Oracle, you can sort the data and then use rownum and aql nested statements to query the first data. The syntax is "select*from(select*from test order by a)where rownum4a40a480a2b243f26719c9bdca4163e5,>=,=,between...and these conditions, because the rownum of the first record obtained from the buffer or data file is 1, it will be deleted, and then remove the record, but it The rownum is still 1, and is deleted again, and so on, and there is no data.

For example, if you want to query the first row of data in the table, you can use the following statement

select * from table where rownum=1 ;

rownum is a sequence that the Oracle database reads from the data file or buffer. order. When it obtains the first record, the rownum value is 1, the second record is 2, and so on.

Recommended tutorial: "Oracle Tutorial"

The above is the detailed content of How to query the first piece of data in oracle. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn