A table has 150 records. How do you retrieve 100th row to
120th row from that table ?
Answers were Sorted based on User's Feedback
Answer / ajit nayak
select rn, ename
from (select rownum rn, ename
from emp)
where rn between 3 and 7;
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sagar sananse
with admitCTE(AdmissionId,PatientId,RN) as
(
select AdmissionId,PatientId,Row_number() over (order by AdmissionId) as RN from tempadmit
)
select * from admitCTE where RN between 101 and 120
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / jayanth
select * from (select a.*, row_number() over (order by empno) rn from emp a) where rn between 100 and 120;
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / nancy
select * from (
select tn.*, rownum rd from emp tn ) where rd between 100 and 200;
or
select * From (select tn.* from emp tn where rownum <201
minus
select tn.* from emp tn where rownum <100)
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / manjunath
select level from dual connect by level<=150
minus select from dual connect by level<=120;
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sravan
select * from emp where rownum<151
minus(select * from emp where rownum<121)
Is This Answer Correct ? | 13 Yes | 14 No |
Answer / bhargav
SELECT * FROM
(
SELECT Row_Number() OVER (ORDER BY emp_id, emp_name) as
emp_name
FROM employees
) as a
where rowid >100 AND rowid<121
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / gourav
SELECT * FROM EMPLOYEES
WHERE EMPLOYEE_ID BETWEEN 120 AND 150;
Is This Answer Correct ? | 2 Yes | 5 No |
Answer / sum
select * from employees where rownum between 100 and 120
Is This Answer Correct ? | 2 Yes | 15 No |
Which is faster subquery or join?
What are sql built in functions?
Can we use distinct and group by together?
Can we write dml inside a function in sql server?
Table Student has 3 columns,Student_id,Student_Name & Course_Id. Table Course has 2 columns, Course_Id & Course_Name.Write a query to listdown all the Courses and number of student in each course.
What is dml with example?
What are the types of optimization?
what is not null constraint? : Sql dba
can i give user defined exception in a package
What is an Exception ? What are types of Exception ?
What are the uses of merge?
what is the difference between trigger and storedprocedures