Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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 t string functions available in tsql? : Transact sql

0 Answers  


trans_id trans_date trans_amt debit_credit_indicator 001 01-JAN-13 1099 cr 001 12-JAN-13 500 db 002 24-FEB-13 400 db 002 23-MAR-13 345 cr 001 18-APR-13 800 cr 002 15-MAR-13 600 db 001 12-FEB-13 200 cr i want like this output trans_id trans_date trans_amt debit_credit_indicator 001 JAN 1599 cr no.of trans 2 i want trans_id and trans_date like 'JAN' or 'FEB' etc, trans_amt i want all credit amount - debit amount per each trans_id. and debit_credit_indicator and no.of transactions in a month.

1 Answers   Oracle,


What can be a size of a pl/sql block? Is there any limit?

2 Answers  


How many types of triggers are there in pl sql?

0 Answers  


How do I use google cloud in sql?

0 Answers  


i have a customer table. trans_id trans_date trans_amt debit_credit_indicator 001 01-JAN-13 1099 cr 001 12-JAN-13 500 db 002 24-FEB-13 400 db 002 23-MAR-13 345 cr 001 18-APR-13 800 cr 002 15-MAR-13 600 db 001 12-FEB-13 200 cr i want like this output. trans_id trans_amt debit_credit_indicator i want get highest credit amount and lowest credit amount and highest debit amount and lowest debit amount for each trans_id.

2 Answers   Oracle,


How to find last day of the month in sql query

4 Answers  


What are the benefits of using PL/SQL packages?

3 Answers  


What does plvtab enables you to do when you showthe contents of pl/sql tables?

0 Answers  


What are inbuilt functions in sql?

0 Answers  


What are the different parts of a package?

0 Answers  


What is the main reason behind using an index?

0 Answers  


Categories