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



1.In a table Gender is a column in that male and female are the two data.In a single statement i ha..

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

1.In a table Gender is a column in that male and female are the two data.In a single statement i ha..

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

1.In a table Gender is a column in that male and female are the two data.In a single statement i ha..

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

Post New Answer

More Oracle AllOther Interview Questions

A scenario for amount correction & how to use amount correction functionality in AP invoices

0 Answers  


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

0 Answers  


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

0 Answers   Infosys,


How do you create a credit note against an invoice? : oracle accounts receivable

0 Answers  


What command would you use to create a backup control file?

1 Answers  






What is store procedure?and how do u take the values from database and run in scripts?

2 Answers   Polaris,


What are different types of receipt reversals ? Explain them : oracle accounts receivable

0 Answers  


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

0 Answers   HCL,


IS IT POSSIBLE TO CREATE REPORTS FROM DIFFERENT UNIVERSES IN ONE DOCUMENT?

0 Answers  


What is the sql query to find the employee who has Nth maximum salary?

2 Answers  


You have just compiled a PL/SQL package but got errors, how would you view the errors?

1 Answers  


what is debit memo and credit memo in AR?

1 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1808)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)