How to update a rows with opposite gender in Sql?

In Emp table there is a column which consists of gender (Male or Female) ? How should one
Can update the Values of Male to Female and Female to Male with a single query ?

Questions by raiyaans   answers by raiyaans

Showing Answers 1 - 30 of 30 Answers

Anamika Mehera

  • Aug 5th, 2014
 

Select Decode(gender,m,f,f,m,null) from table

  Was this answer useful?  Yes

puneet

  • Aug 25th, 2014
 

Above code should be like this..

Code
  1. SELECT Decode(:gender,m,female,f,male,NULL) FROM dual;

  Was this answer useful?  Yes

Dinesh

  • Sep 12th, 2014
 

Here the question is how to update the Table not how you show the table

  Was this answer useful?  Yes

Subalakshmi R

  • Sep 24th, 2014
 

There should be some additional condition to be applied against another column apart from the gender column. otherwise, it is not possible.

  Was this answer useful?  Yes

sagar bodala

  • Nov 3rd, 2014
 

using decode like Decode(M,F,M) ,( if in case the column values are stored in M,F format)

  Was this answer useful?  Yes

santosh

  • Nov 11th, 2014
 

The above question is update the rows,not for display purpose.we required to make select statement in update query.

  Was this answer useful?  Yes

NARSIMHA

  • Nov 13th, 2014
 

SELECT DECODE(GENDER,M,F,F,M,NULL) FROM EMP

  Was this answer useful?  Yes

sandeep

  • Nov 22nd, 2014
 

i need to update in the table not to select can u guys show me how to change directly in the database

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions