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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the select statement in sql?

616


Which nosql database is best?

515


Which column of the user triggers data dictionary view displays the database event that will fire the trigger?

595


How do I install sql?

524


What is mdf ldf and ndf?

563






What is lookup table in sql?

605


Is sql a scripting language?

521


What is nosql example?

585


What is the syntax to add a record to a table?

577


Why truncate is faster than delete?

565


What is the difference between a primary key and a clustered index?

526


What is the use of function in sql?

541


What are the two types of exceptions in pl/sql?

548


What are the different ddl commands in sql?

582


Can we use the cursor's to create the collection in PL/SQL?

522