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 |
Can we write create command in the plsql block?if possible how?
How to use boolean type in select statement?
What operators deal with null?
what is a control file ? : Sql dba
Can we edit a view in sql?
Is full outer join same as cross join?
Give me some examples of predefined exceptions.
Where are my tempfiles, I don't see them in v$datafile or dba_data_file?
What is the difference between sum and count in sql?
What is the Query to print out the individual total number of duplicate row in sql.
what is the difference between a web-garden and a web-farm? : Sql dba
What is bitemporal narrowing?
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)