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
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 |
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 |
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 |
Answer / sushma s
Update table_name
Set gender = decode(gender,'M','F','M');
| Is This Answer Correct ? | 8 Yes | 9 No |
Does pdo prevent sql injection?
What is embedded sql in db2?
what are the differences between public, private, protected, static, transient, final and volatile? : Sql dba
What is dynamic SQl and how you will create and execute dynamic sql?
what is the difference between granting and creating a view?
Is it possible to create startup or shutdown trigger for on-schema?
What is a merge query?
function can return value ,procedure also return value through out parameter then what is the difference?
What does partition by mean in sql?
How do I save the results of sql query in a file?
what is pragma ?
How you can copy a file to file content and file to pl/sql table in advance pl/sql?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)