Hi Everyone,
How to get fist and last record from a table in oracle?

Thanks in advance

Answers were Sorted based on User's Feedback



Hi Everyone, How to get fist and last record from a table in oracle? Thanks in advance..

Answer / cbigmudre

(select * from table limit 0,1)
union
(select * from table order by Id desc limit 0,1)

Is This Answer Correct ?    0 Yes 3 No

Hi Everyone, How to get fist and last record from a table in oracle? Thanks in advance..

Answer / gourav

select * from employees
where employee_id=100
union
select* from employees
where employee_id=206;


Example

first coulumn_ id(100)
last column _id(206)

Is This Answer Correct ?    0 Yes 4 No

Hi Everyone, How to get fist and last record from a table in oracle? Thanks in advance..

Answer / ravi singh

select * from table_name
where rownum = 1
union
select * from table_name
where rownum > (select (count(1) - 1) from table_name);

I think this should work. try

Is This Answer Correct ?    3 Yes 18 No

Post New Answer

More SQL PLSQL Interview Questions

What are the types of optimization?

0 Answers  


What is the difference between view and stored procedure?

0 Answers  


what are numeric data types? : Sql dba

0 Answers  


What is a sql*loader control file?

0 Answers  


hi sql gurus, here is my question 4 u. i wanna use triggers for sending reminder mail to all users who are registered to the site. if any one knws the code plz send me ans here : chayabs3@gmail.com thnx advance

1 Answers  






What is trigger and types?

0 Answers  


explain advantages of myisam over innodb? : Sql dba

0 Answers  


What is pl sql block in dbms?

0 Answers  


What is basic structure of pl sql?

0 Answers  


How to create a table using constraints... IF i change the PARENT KEY value ,then CHILD KEY table will also to change in the another table... plz reply ur answers @ mak2786@gmail.com Arunkumar

3 Answers  


what is the syntax for using sql_variant_property? : Transact sql

0 Answers  


What is keys and its types?

0 Answers  


Categories