1.In a table Gender is a column in that male and female are
the two data.In a single statement i have to modify all male
to female and all female to male vice versa.
2.In a single query i need the count of male data,count of
female and total count
Answers were Sorted based on User's Feedback
Answer / sagar shinde
--Query for 1
update EMPLOYEE
set GENDER = decode(GENDER,'M','F','M')
/
--Query for 2
select GENDER,count(*)
from EMPLOYEE
group by GENDER
| Is This Answer Correct ? | 10 Yes | 0 No |
Answer / anithaletchumi
1.In a table Gender is a column in that male and female are
the two data.In a single statement i have to modify all male
to female and all female to male vice versa.
ans->
update emp_table e set gender = (select case gender
when 'F' then 'M' else 'F' end from emp_table f where
e.empid = f.empid and e.gender=f.gender);
-- empid is the primary key.
2.In a single query i need the count of male data,count of
female and total count
ans 1->
select ( select count(empid) from emp_table where
gender='m' or gender='M') as count_male, ( select count
(empid) from emp11 where gender='f' or gender='F') AS
count_female,( select count(empid) from emp_table) as
tot_count from dual;
ans 2->
select sum(decode(gender,'F',1,'f',1)) as count_female,sum
(decode(gender,'M',1,'m',1)) as count_male,count(*) as
tot_count from emp_table;
| Is This Answer Correct ? | 9 Yes | 3 No |
Answer / kd
2.
select gender, count(*)
from employee
group by gender
union
select 'total' as gender, count(*)
from employee
| Is This Answer Correct ? | 3 Yes | 0 No |
what is difference between inner join & nested query or subqueries
I need a Technical evaluation between Oracle and SAP ? please do a need ful.
i am having comm in emp table and i want to display 0 when comm =null and -10 if comm= value
statement string in open is null or 0 length ORA-40735
the user should know to which database he is connected currently in oracle
i am working with OC 4.5 i have numbers in table in 10 row with some null values please tell me how to find total? Thanks
how to get the values if source table & target table having duplicate values that matches the lookup condition ?(i want all duplicate match)
Hi, I want to know basic information about Oracle HRMS and the institutes in hyderabad or the best faculty as i want to make my career in it.And also want to know may a person from non technical background be able to do this course. Regards, Swetha
Where would you look for errors from the database engine?
How would you determine what sessions are connected and what resources they are waiting for?
hi iam kavya, i completed Oracle11i(finance module), i do not know how to face the interview questions please adivese me
Describe the P2P cycle ?