how to achieve this problem?i am having table with two
colums like empno,gender.
in gender column, i am having records male,female like that
.my final output will be
male female
5 6
Answers were Sorted based on User's Feedback
Answer / shivaindu
SQL> select sum(decode(gender, 'male', 1)) as Male,
sum(decode(gender, 'female', 1)) as Female from
emp1;
MALE FEMALE
---------- ----------
9 7
| Is This Answer Correct ? | 16 Yes | 1 No |
Answer / jayakrishnan
select count(case gender when 'male' then 1 end) Male,
count(case gender when 'female' then 1 end) Female from emp1
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / sudeep ranjan
select gender,count(gender)as gender_count from emp group
by gender;
| Is This Answer Correct ? | 5 Yes | 1 No |
Answer / venkat
select Count(gender) from emp group by gender with rollup
| Is This Answer Correct ? | 1 Yes | 0 No |
How is debugging done?
Why do we use procedures in pl sql?
What are the types of index in sql?
what is timestamp in mysql? : Sql dba
Difference between SUBSTR and INSTR?
what is the bond code in materialized view?
How to return an array from java to pl/sql?
What is the order of sql select?
What is scope of pl sql developer in future?
What is sql partition function?
what is difference between procedure and function, procedure and trigger?
Is sql low level language?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)