i have a table like this.
cityno cityname mails
1 BANGALORE 8KM
2 HSR LAYOUT 20KM
3 MEJISTIC 30KM
4 JAYADEVA 55KM
5 ITPL 80KM
6 HEBBAL 115KM
I HAVE DATA LIKE THIS
I WANT O/P LIKE THIS
DISTANCE NO.OFCITY
0-50KM 3
51-100KM 2
101-150KM 4
AND SO ON
pls give me answer. i want urgent
Answer Posted / apoorva garg
cityno cityname mails
1 BANGALORE 8KM
2 HSR LAYOUT 20KM
3 MEJISTIC 30KM
4 JAYADEVA 55KM
5 ITPL 80KM
6 HEBBAL 115KM
create table city(name varchar2(10), miles number);
insert into city values('bangalore',8)
insert into city values('hsr',20)
insert into city values('majestic',30)
insert into city values('jayadeva',55)
insert into city values('itpl',80)
insert into city values('hebbal',115)
DISTANCE NO.OFCITY
0-50KM 3
51-100KM 2
101-150KM 4
select * from city
select count(miles),miles
from
(select name,
CASE
WHEN (miles>=0 and miles <=50) THEN '0-50KM '
WHEN (miles>=51 and miles <=100) THEN '51-100KM '
WHEN (miles>=101 and miles <=150) THEN '101-151KM '
END miles
from city)
group by miles
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are local and global Indexes and where they are useful.
What is meant by temporal data?
What is cursor and why it is required?
Can we create clustered index without primary key?
Mention what is the plv (pl/vision) package offers?
What trigger means?
What is server name sql?
What is the limitation on the block size of pl/sql?
What is mutating sql table?
What are the advantages of pl sql?
what is the difference between clustered and non clustered index in sql? : Sql dba
Explain the difference between cursor declared in procedures and cursors declared in the package specification?
Determine if oracle date is on a weekend?
how to convert numeric values to character strings? : Sql dba
how can we submit a form without a submit button? : Sql dba