Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

how u can find the n row from a table?

Answers were Sorted based on User's Feedback

how u can find the n row from a table?..

SELECT EMPLOYEE_ID,LAST_NAME,SALARY,DEPARTMENT_ID
FROM (SELECT ROWNUM
R,EMPLOYEE_ID,LAST_NAME,SALARY,DEPARTMENT_ID FROM EMPLOYEES) A
WHERE A.R=&Record_Number;

---------------------------------------------
(This is easy method to find nth record from a table).....

 Is This Answer Correct ? 29 Yes 5 No

how u can find the n row from a table?..

kindly give a delete option for the users to delete wrong

 Is This Answer Correct ? 25 Yes 3 No

how u can find the n row from a table?..

select * from emp where rownum<=n
minus
select * from emp where rownum<n

n=1,2,......so many

 Is This Answer Correct ? 4 Yes 0 No

how u can find the n row from a table?..

If you want nth record from table employee then..

select * from employee where rownum <= n
minus
select * from employee where rownum < n

the above query will suffice.

 Is This Answer Correct ? 3 Yes 1 No

how u can find the n row from a table?..

select emp_name,salary,rownum from
(select emp_name,salary,r from
(select salary,emp_name,rownum r from
(select salary,emp_name,rownum
from emp
order by salary desc)
order by r)
where r<4 ---- this number must be n+1
order by salary)
where rownum=1;
-- yes rownum=1 works...

 Is This Answer Correct ? 4 Yes 3 No

how u can find the n row from a table?..

select * from
(
select rownum r,a.* from TableName a
)
where r=n'th

 Is This Answer Correct ? 5 Yes 4 No

how u can find the n row from a table?..

select rowid,[optional columns...] from table where
rowid='n';
--n would be the input from the user which will let you
identify the row number of that particular record

 Is This Answer Correct ? 1 Yes 0 No

how u can find the n row from a table?..

SELECT EMPLOYEE_ID,LAST_NAME,DEPARTMENT_ID
FROM (SELECT ROWNUM
R,EMPLOYEE_ID,LAST_NAME,DEPARTMENT_ID FROM EMPLOYEES) A
WHERE A.R=&Record_Number;

 Is This Answer Correct ? 1 Yes 0 No

how u can find the n row from a table?..

try this works in mysql

select * from table_name limit n-1,1;

 Is This Answer Correct ? 1 Yes 0 No

how u can find the n row from a table?..

select * from employees where rownum<=&nth_row
/

 Is This Answer Correct ? 0 Yes 0 No

More SQL PLSQL Interview Questions

Why do we need sharding?

Can we write dml inside a function in sql server?

Can we perform dml on view?

Write a query to get last 10 records from the table.

What are the PL/SQL Statements used in cursor processing ?

What does dml mean?

Is record in pl sql?

Can two tables have same primary key?

How long does it take to learn pl sql?

How do I run a sql trace?

How can multiply values of a column? OR How can multiply value of a row of a column using a single query in SQL?

what are local and global variables and their differences? : Sql dba

Categories
• Oracle (3238)
• SQL Server (4518)
• MS Access (429)
• MySQL (1385)
• Postgre (483)
• Sybase (267)
• DB Architecture (141)
• DB Administration (291)
• DB Development (113)
• SQL PLSQL (3302)
• MongoDB (502)
• IBM Informix (50)
• Neo4j (82)
• InfluxDB (0)
• Apache CouchDB (44)
• Firebird (5)
• Database Management (1391)
• Databases AllOther (288)