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



how to achieve this problem?i am having table with two colums like empno,gender. in gender column..

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

how to achieve this problem?i am having table with two colums like empno,gender. in gender column..

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

how to achieve this problem?i am having table with two colums like empno,gender. in gender column..

Answer / sudeep ranjan

select gender,count(gender)as gender_count from emp group
by gender;

Is This Answer Correct ?    5 Yes 1 No

how to achieve this problem?i am having table with two colums like empno,gender. in gender column..

Answer / venkat

select Count(gender) from emp group by gender with rollup

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

What is sql lookup?

0 Answers  


Hi am new to PLSQL & facing problems in writing code like in SP, Functions, so any one having some SP coding with in depth explanation please share with me my Email ID suvarnaatsuvarna@rediffmail.com Or taking tanning on this please do contact me

0 Answers  


What is range partitioning?

0 Answers  


What is use of trigger?

0 Answers  


what are the different tables present in mysql? : Sql dba

0 Answers  






difference between pl/sql table and normal pl/sql table

2 Answers  


How can we find duplicate records in a table?

0 Answers  


How does an execution block start and end in pl sql?

0 Answers  


Does it possible to pass object (or) table as an argument to a remote procedure?

1 Answers   TCS,


i have a table eno dno sal 1 10 200 2 10 150 3 10 100 4 20 75 5 20 100 i want to get sal which is less than the avg sal of thri dept. eno dno sal 2 10 150 3 10 100 4 20 75

12 Answers   IBM,


What is the limitation on the block size of pl/sql?

0 Answers  


How to Declare Fixed Length String Value In PL SQL

0 Answers  


Categories