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
Does user triggers have entry for trigger with compilation errors?
What is the difference between python and sql?
What is delimiter in pl sql?
What are properties of the transaction?
What does count (*) mean?
How do I make sql search faster?
What are the types of records?
What are triggers in sql?
what are date and time data types? : Sql dba
What can sql server reporting services do?
Can you have more than one trigger on a table?
What is join view in sql?
what are the features and advantages of object-oriented programming? : Sql dba
how to drop an existing index in mysql? : Sql dba
How do you know if a relationship is 2nf?