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??
Answer Posted / krishna
This Query shall do the trick.
SQL> desc a;
Name Null? Type
------------------------------- -------- ----
A NUMBER(2)
SQL> select * from a;
A
---------
1
5
7
SQL> select x from (
2 select rownum x from all_tables ) a, (select max(a)
mx, min(a) mi from a) b
3 where a.x between b.mi and b.mx
4 and a.x not in (select * from a)
5 /
X
---------
2
3
4
6
SQL>
| Is This Answer Correct ? | 9 Yes | 1 No |
Post New Answer View All Answers
Write an sql query to select all records from the table?
Is it possible for a table to have more than one foreign key?
What is embedded sql in db2?
What is t sql in sql server?
What is recursive stored procedure?
What is the difference between a subquery and a join?
what is the difference between truncate and drop statements? : Sql dba
What is an alias command?
What is trigger types in sql?
What does where 1/2 mean in sql?
Explain the insert into statements in sql?
Can we edit a view in sql?
What does 0 mean in sql?
What is a full join sql?
What is cross join sql?