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

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

i am pursuing mca and i want to do oracle apps technical in hydrabad, plz guide me tne best institue in hydrabad those have excellent knowledge in oracle apps.

1858


What is the importance of batch source set up in ar? : oracle accounts receivable

718


Difference between transaction type and transaction sources. : oracle accounts receivable

583


which one is currently in used software cmpanies.

1663


Can we modify approve purchase order?if yes what is navigation?

1551






hi iam kavya, i completed Oracle11i(finance module), i do not know how to face the interview questions please adivese me

1778


Explain prerequisites and post activities of oracle database installation

1621


Where in the Oracle directory tree structure are audit traces placed?

2131


what ASIS BUSINESS PROCESS IN ORACLE FINANCE

1773


I am Bsc Computer Science Graduate, I have good knowledge in SQL 7.0, Can I go for Oracle APPS course please suggest me the answer

1830


What is the use of lockboxes? Steps for lock box : oracle accounts receivable

731


What are the advantages of operating a database in ARCHIVELOG mode over operating it in NO ARCHIVELOG mode in Oracle?

653


What is an Oracle database Partial Backup?

702


HOW TO GET THE ORGANIZATION TO ORGANIZATION DETAILS INFORMATION IN THE INVENTORY MODULE.THE REQUIREMENT IS FROMORG TOORG FROMINV TOINV ..

1993


How to clone the database using RMAN back

1621