Question: Below is the table
city gender name
delhi male a
delhi female b
mumbai male c
mumbai female d
delhi male e
I want the o/p as follows:
male female
delhi 2 1
mumbai 1 1
Please help me in writing the query that can yield the o/p
mentioned above?
Answer Posted / kavitha nedigunta
select city,
count(decode(lower(gender),'male','female',null)) male,
count(decode(lower(gender),'female','male',null)) female
from gen
group by city;
| Is This Answer Correct ? | 8 Yes | 2 No |
Post New Answer View All Answers
How does stored procedure reduce network traffic?
Is it possible for a table to have more than one foreign key?
How does a trigger work?
What is crud sql?
What are pl/sql cursor exceptions?
How do I count rows in sql?
what are the limitations of mysql in comparison of oracle? Mysql vs. Oracle. : Sql dba
Is sql easier than java?
What is trigger and types?
How can you save or place your msg in a table?
Can we use joins in subquery?
What is the difference between a database and a relational database?
Which table is left in join?
Can we rollback delete command?
How can a function retun more than one value in oracle with proper example?