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
Which operator is used in query for pattern matching?
What is the example of procedure?
What is a native sql query?
what is 'mysqlcheck'? : Sql dba
What does inner join mean?
How do you delete duplicates in sql query using rowid?
What are predefined functions in sql?
what are the disadvantages of mysql? : Sql dba
Lookups are a key component in sql server integration services (ssis). Explain its purpose?
Inline the values in PL/SQL, what does it mean.?
Define join and name different types of joins?
what are properties of a transaction? : Sql dba
How to start the command-line sql*plus?
What is a temp table?
What is PL/SQL Records?