Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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 embedded sql what are its advantages?

0 Answers  


what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba

0 Answers  


What is a sql select statement?

0 Answers  


What is bulk collect in pl sql?

0 Answers  


What is error ora-12154: tns:could not resolve the connect identifier specified?

0 Answers  


What is difference between stored procedure and trigger?

0 Answers  


What is a composite primary key?

0 Answers  


What is Raise_application_error ?

1 Answers  


what are the forced views

6 Answers   Hexaware, TCS,


Is sql a microsoft product?

0 Answers  


What is the difference between nested table and varray?

0 Answers  


what is 'trigger' in sql? : Sql dba

0 Answers  


Categories