5
Reply

SELECT * FROM EMP WHERE ROWNUM > 5. What will be the output of the query and why

Suraj Jaiswal

Suraj Jaiswal

Jan 14, 2008
10.4k
0

    I did not find this type of function or keyword in Ms Sql Server. Can you explain what is this......

    this query won't work bcoz rownum only understand the selective records if u put less than 5 then it will work bcoz it's consecutive records but for rownum>5 it will result none

    see example:

    SQL> SELECT * FROM EMP_mdindia WHERE ROWNUM > 5
      2  ;

    no rows selected

    manoj
    March 10, 2008
    0

    I'm describing with a little bit descriptive way:

    1. The SQL query 'select * from Emp' will fetch all the records from Emp table

    2. The SQL query 'select * from Emp where ROWNUM>5' also fetch all the records as the result in previous but except first 5 rows.

    Elias Hossain
    January 26, 2008
    0

    The 'ROWNUM'  is a pseudo column which returns a nummber indicating the order in which the rows are fetched from Databae.

       If Orderby clause follows the ROWNUM then the rows will be recorded by the orderby clause.

     The query 'select * from Emp where ROWNUM>5' fetch all the records of emp table

    except the first 5 records 

    Darshan Malu
    January 21, 2008
    0

    The 'ROWNUM'  is a pseudo column which returns a nummber indicating the order in which the rows are fetched from Databae.

       If Orderby clause follows the ROWNUM then the rows will be recorded by the orderby clause.

     The query 'select * from Emp where ROWNUM>5' fetch all the records of emp table

    except the first 5 records 

    Darshan Malu
    January 21, 2008
    0