Posts

Showing posts from November, 2020

How to fetch 20 percent rows only from Oracle db

 To fetch 20% of rows from oracle db , you can write query as follows select columnName from tablename order by columnName  desc/asc fetch first 20 percent rows only; Example: To fetch top 20% of employee Numbers from Employee table , For example if Employee table has 200 rows it will fetch 40 rows empno in ascending order. select EMPNO from EMPLOYEE order by EMPNO asc fetch first 20 percent rows only;