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

What is the difference between join and natural join?

927


How many sql statements are used? Define them.

1035


How do I use google cloud in sql?

1084


What is dialect in sql?

942


Why triggers are used?

987


What is raid? How does it help storage of databases?

1081


How do I find duplicates in two columns?

1162


What are crud methods?

1028


What is the difference between sql and t sql?

1031


how to install mysql? : Sql dba

1103


What is indexing oracle sql?

1098


Is postgresql a nosql database?

1154


Is sql developer case sensitive?

994


Explain the significance of the & and && operators in pl sql.

1007


what is a field in a database ? : Sql dba

1053