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.

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the process of debugging?

741


What is the purpose of design view?

729


What is difference between nchar and nvarchar?

695


What are the different sql languages?

742


How delete a row in sql?

722






how to use like conditions? : Sql dba

786


Can %notfound return null after a fetch?

757


What is the difference between null value, zero, and blank space?

769


Is oracle sql free?

734


what is difference between delete and truncate commands? : Sql dba

810


What are pl sql procedures?

701


How many sql are there?

733


What are the types of variables use in pl sql?

691


What is %type in pl sql?

713


Can we update views in sql?

686