Skip to content

Commit 6c89749

Browse files
add best example using row limiting clause in G-3185
1 parent a4e584e commit 6c89749

File tree

1 file changed

+15
-0
lines changed
  • docs/4-language-usage/3-dml-and-sql/1-general

1 file changed

+15
-0
lines changed

docs/4-language-usage/3-dml-and-sql/1-general/g-3185.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,19 @@ select first_name
3737
order by salary desc
3838
)
3939
where rownum <= 5; -- NOSONAR: G-1050 literal is ok for a standalone query
40+
```
41+
42+
## Example (best)
43+
44+
(Assuming you are using Oracle Database 12c or later.)
45+
46+
``` sql
47+
select first_name
48+
,last_name
49+
,salary
50+
,hire_date
51+
,rank() over (order by salary desc) as salary_rank
52+
from employees
53+
order by salary desc
54+
fetch first 5 rows only; -- NOSONAR: G-1050 literal is ok for a standalone query
4055
```

0 commit comments

Comments
 (0)