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

Can we use rowid as primary key?

0 Answers  


What mean sql?

0 Answers  


how to give permission to users that users can update/insert/delete on a row of table on timeing 10am to 6pm only?

4 Answers   TCS,


What are the string functions in sql?

0 Answers  


Can we insert in sql function?

0 Answers  






Types of joins ?

3 Answers   Digital GlobalSoft, HeadStrong,


What can you do with pl sql?

0 Answers  


Why sql query is slow?

0 Answers  


How many columns should be in an index?

0 Answers  


What are the different types of constraints?

0 Answers  


What is pragma exception and how, when, where us

5 Answers  


How many database objects (trigger, packages, sequence etc) uses a particular field in a given table. For ex: I want to know how many database object uses the ATTRIBUTE1 in the PO_VENDORS table. What query will give me the result showing the database object name(package, trigger etc), field_name used (in this case ATTRIBUTE1) and table_name (in this case PO_VENDORS).

2 Answers   IBM,


Categories