Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Fetch limited number of rows from a table using ROWNUM

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 471
    Comment on it

    If you want to Fetch limited numbers of rows from a table in oracle you can use Rownum. Or in other words we can say that
    It is used to return specific number of rows in a query, we can use ROWNUM in Oracle and LIMIT in MySql.

    ROWNUM Syntax for Oracle:

    1) SELECT col_name(s)

    2) FROM tablename

    3) WHERE rownum<=number ;

    Example:

    If we have to return only first four employee names then the query will be:

    SELECT  emp_names 
    FROM Employee
    WHERE rownum<=4;

    It will return the first four records(emp_names) from Employee table.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: