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 sql does db2 use?

536


What is the use of procedures?

535


How to call a javascript function from pl sql?

555


explain the delete statements in sql

575


How global cursor can be declare with dynamic trigger ?

1741






Enlist the advantages of sql.

565


What is the difference between database trigger and stored procedure?

547


What is a crud api?

493


Can we use ddl commands in pl sql?

552


What are the types of variables use in pl sql?

496


What is the use of index in sql?

548


what is a composite key ? : Sql dba

588


Can we use loop in sql?

528


What are different types of triggers?

549


What is 19 null in sql?

526