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
What are expressions?
What is sql constant?
Will truncate release space?
What is left join in postgresql?
What is sql used for?
How to select unique records from a table?
What is difference between pls_integer and integer?
what does it mean to have quoted_identifier on? What are the implications of having it off? : Sql dba
what is the functionality of the function htmlentities? : Sql dba
What is sqlcontext?
What is update query?
What is the use of primary key?
Can we write ddl statements in functions?
What is output spooling in sql*plus?
What is lexical units in pl sql?