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
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 |
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 |
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 |
What is Collation Sensitivity ? What are the various type ?
suppose we have values like 1 5 7 in a colum.Now we want numbers like(2 3 4 6) that exists between 1 5 7.How can we do this using sql query??
how to concatenate two character strings? : Sql dba
what is recursive stored procedure? : Sql dba
What is package in pl sql with an examples?
What do you mean by stored procedures? How do we use it?
How do you modify a column in sql?
How many tables can a sql database have?
how to delete duplicate rows from a specified table(only single table) how do you know which join is need to be used
What is normalization in a database?
Why truncate is faster than delete?
The in operator may be used if you know the exact value you want to return for at least one of the columns.
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)