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 |
Types of locks in database ?
what is the use of double ampersand (&&) in sql queries?
how will you find out the last three records in a table with n no of records and delete them
What is a database link?
How can we Get the Updated Rows? ie, There is 100s of Rows i updated the Rows who have salary 5000. then i want to select the Updated Rows. How can we achieve it?
What is the difference between RDBMS and DBMS?
20 Answers Practical Viva Questions, Sapient, Stag Computers,
What are the types of views in sql?
What does select * from mean in sql?
using cursors salesman get bonus as 10% of their salary , managers get 20% , analalist get 30%. generae a report showing the employee name, salary , bonus.
What is column?
Under what condition it is possible to have a page level lock and row lock at the same time for a query? : Transact sql
How to get second highest salary from a table