Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

limit rows returned

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0

Hi there,

How do I limit the number of rows returned by SQL

Alasdair
 
Try using rownum:

SELECT * FROM my_table WHERE rownum < 6;

will return no more than five rows.
 
Try using the WHERE clause to restrict the number of rows to be fetched.

Example :

SELECT *
FROM emp
WHERE empno = 8349;

or

SELECT *
FROM emp
WHERE sal > 1500;

Hope this help :)

 
BETWEEN

TRY TO USE BETWEEN CLAUSE BECAUSE IT WOULD GIVE YOU THE
EXACT DESIRED RESULT.

SELECT * FROM EMP
WHERE
SAL BETWEEN 1000 AND 3000;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top