Interchange the value of a column Gender in a table where
values are Male and Female. So, where the value is Male, it
should changed to Female and Female to Male.

Answers were Sorted based on User's Feedback



Interchange the value of a column Gender in a table where values are Male and Female. So, where th..

Answer / parli jain

Update table_name
set Gender = decode (Gender, 'M', 'F', 'F,'M')
where Gender In ('M','F');

Is This Answer Correct ?    29 Yes 4 No

Interchange the value of a column Gender in a table where values are Male and Female. So, where th..

Answer / raghu

UPDATE TABLE_NAME
SET GENDER=( CASE GENDER
WHEN 'M' THEN 'F'
WHEN 'F' THEN 'M'
END )
WHERE GENDER IN('M','F')

Is This Answer Correct ?    22 Yes 2 No

Interchange the value of a column Gender in a table where values are Male and Female. So, where th..

Answer / ram

UPDATE TABLE
SET GENDER=(CASE GENDER
WHEN 'M' THEN 'F'
WHEN 'F' THEN 'M'
END) WHERE GENDER IN ('M','F')

Is This Answer Correct ?    0 Yes 0 No

Interchange the value of a column Gender in a table where values are Male and Female. So, where th..

Answer / sushma s

Update table_name
Set gender = decode(gender,'M','F','M');

Is This Answer Correct ?    8 Yes 9 No

Post New Answer

More SQL PLSQL Interview Questions

Types of locks in database ?

8 Answers   HCL, TCS, Tieto,


what is the use of double ampersand (&&) in sql queries?

0 Answers  


how will you find out the last three records in a table with n no of records and delete them

3 Answers  


What is a database link?

3 Answers  


How can we Get the Updated Rows? ie, There is 100s of Rows i updated the Rows who have salary 5000. then i want to select the Updated Rows. How can we achieve it?

4 Answers   Fidelity, KCP,






What is the difference between RDBMS and DBMS?

20 Answers   Practical Viva Questions, Sapient, Stag Computers,


What are the types of views in sql?

0 Answers  


What does select * from mean in sql?

0 Answers  


using cursors salesman get bonus as 10% of their salary , managers get 20% , analalist get 30%. generae a report showing the employee name, salary , bonus.

4 Answers   Fidelity,


What is column?

0 Answers  


Under what condition it is possible to have a page level lock and row lock at the same time for a query? : Transact sql

0 Answers  


How to get second highest salary from a table

3 Answers  


Categories