how to find the First and Last Observation from the table:
Ex: OBS Name Sal Ans like: OBS Name Sal
105 E 5000--> 105 E 5000
102 B 2000 104 D 4000
103 C 3000
101 A 1000-->
104 D 4000

Answers were Sorted based on User's Feedback



how to find the First and Last Observation from the table: Ex: OBS Name Sal Ans like: OB..

Answer / shailesh jori

select * from table_name where rowid=(select min(rowid) from table_name) or rowid=(select max(rowid) from table_name)

Is This Answer Correct ?    5 Yes 3 No

how to find the First and Last Observation from the table: Ex: OBS Name Sal Ans like: OB..

Answer / ajit

SELECT MIN(Obs)
FROM <Table_name>
UNION ALL
SELECT MAX(Obs)
from <Table_name>;

Is This Answer Correct ?    1 Yes 0 No

how to find the First and Last Observation from the table: Ex: OBS Name Sal Ans like: OB..

Answer / mahendar reddy

select *from t_name where rownum=1
union
(select *from t_name
intersect
select *from t_name where rowid=(select max(rowid)from t-name));

Is This Answer Correct ?    0 Yes 0 No

how to find the First and Last Observation from the table: Ex: OBS Name Sal Ans like: OB..

Answer / arjun

select * from tablename where rowid=1
union
( select * from tablename
intersect
select * from tablename where rowid = ( select max(rowid)
from tablename));

Is This Answer Correct ?    0 Yes 6 No

Post New Answer

More SQL PLSQL Interview Questions

how to get @@error and @@rowcount at the same time? : Sql dba

0 Answers  


Can you sum a count in sql?

0 Answers  


What is sp_helptext?

0 Answers  


What is bulk collections?

2 Answers  


table :- city name country code abc 11 bcd 22 cde 232 def 33 write a procedure , so that when we give a phone no. eg - 1123456789 - o/p sud be city name = abc if phone no. - 2322345897 , o/p sud be =cde note - bcd and cde city name sud be diff. as dey diff only with th last no. Pls ans. this questnion.

1 Answers  






What is #table in sql?

0 Answers  


What are tables in sql?

0 Answers  


How do I edit a stored procedure?

0 Answers  


What has stored procedures in sql and how we can use it?

0 Answers  


how can we know the number of days between two given dates using mysql? : Sql dba

0 Answers  


Which one of the following join types will always create a Cartesian Product? 1. CROSS JOIN 2. LEFT OUTER JOIN 3. RIGHT OUTER JOIN 4. FULL OUTER JOIN 5. INNER JOIN

2 Answers  


what are all the different types of indexes? : Sql dba

0 Answers  


Categories