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...

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


Please Help Members By Posting Answers For Below Questions

Write an sql query to select all records from the table?

967


Is it possible for a table to have more than one foreign key?

971


What is embedded sql in db2?

952


What is t sql in sql server?

1000


What is recursive stored procedure?

1045


What is the difference between a subquery and a join?

1009


what is the difference between truncate and drop statements? : Sql dba

1030


What is an alias command?

1000


What is trigger types in sql?

941


What does where 1/2 mean in sql?

1006


Explain the insert into statements in sql?

934


Can we edit a view in sql?

924


What does 0 mean in sql?

910


What is a full join sql?

980


What is cross join sql?

863