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 |
What is Difference Between Unique and Primary Key Constraints?
How insert into statements in sql?
Can we use SQL%ISOPEN in implicit cursors? Does this attribute works properly in Implicit Curosors?
why does the selected column have to be in the group by clause or part of an aggregate function? : Sql dba
What is column?
How do you declare a variable in pl sql?
What is an escape character in sql?
What do we need to check in database testing?
If I have a table T with 4 rows & 2 columns A & B. A has values 1,2,3,4. and B has 10,20,30,40. Write an Update SQL query which can Swap the values of A & B for all records. (Do not use a sub-query)
what is difference between pass by value and eference by value in oracle plsql
write a query to display diference between two dates in sql server
What are sql functions? Describe the different types of sql functions?