how u can find the n row from a table?
Answers were Sorted based on User's Feedback
Answer / santosh kumar
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 ? | 30 Yes | 5 No |
kindly give a delete option for the users to delete wrong
answer. administrator also should verify the answers regularly
Is This Answer Correct ? | 25 Yes | 3 No |
Answer / manish singhania
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 |
Answer / rama krishna
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 |
Answer / rishab
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 |
Answer / santosh dwivedi
select * from
(
select rownum r,a.* from TableName a
)
where r=n'th
Is This Answer Correct ? | 5 Yes | 4 No |
Answer / guest
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 |
Answer / vijayshanker
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 |
Answer / pradeep
try this works in mysql
select * from table_name limit n-1,1;
Is This Answer Correct ? | 1 Yes | 0 No |
select * from employees where rownum<=&nth_row
/
Is This Answer Correct ? | 0 Yes | 0 No |
What is ON DELETE CASCADE?
Fetch an entire row from the employees table for a specific employee ID:
Explain raise_application_error.
What are expressions?
what are the other commands to know the structure of table using mysql commands except explain command? : Sql dba
can we write stored function in out parameters? how to call through select statement? how to written more than one value plz give the exmple?
How does a trigger work?
what are all the common sql function? : Sql dba
What is the difference between a primary key and a clustered index?
Can we join more than 2 tables in sql?
i hv 30 rows with date.ex:1month hav 4 weeks i want 1st day of the every week.write the qry for that.example jan has 4 weeks i need 1st dd for evry wk
Is sql port 1433 encrypted?