Get 10 and 11th records in the output using SQL in 5 ways ?

I have to tables A and B. My records in this table are in such a way that
Table A Table B
10 15
11 16
12 10
13 11
Question :- I want only the 10 and 11 records as my output.
Can anyone help me out ( 5 ways to get this output )

Questions by kalyan.sam

Showing Answers 1 - 12 of 12 Answers

Could you expand a little more on the question a little bit more please. I understand that you have two tables, A and B, but... ok so what, are they related? do you want the data filtered for records on each one? What do you mean by "My records in this table are in such a way that Table A Table B 10 15 11 16 12 10 13 11"? That doesnt make sense.

  Was this answer useful?  Yes

narendar

  • Mar 21st, 2012
 

For example to retrieve 5th to 10th rows in a table emp

select * from ( select A.*, rowid as R from emp A)
where R>=5 and R<=10

  Was this answer useful?  Yes

SivaKumar

  • Mar 23rd, 2012
 

Method 1

Code
  1. SELECT a,employee_id,last_name,first_name,salary FROM

  2. (SELECT ROWNUM AS a,employee_id,last_name,first_name,salary FROM employees)

  3. WHERE a BETWEEN 10 AND 11

  Was this answer useful?  Yes

hussain

  • Mar 29th, 2012
 

Code
  1. SELECT * FROM emp WHERE (rowed,0) IN (SELECT rowid,mod(rownum,5) FROM emp);

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions