id name gender
1 Ram Female
2 Kumar Female
3 sathish Female
4 Santhya Male
5 Durga Male
6 Priya Male

This is my input...how to change Gender Male to Female &
Female to Male??? Write sql query for this question???

Answers were Sorted based on User's Feedback



id name gender 1 Ram Female 2 Kumar Female 3 sathish Female 4 San..

Answer / yuvaevergreen

I am not sure whether decode will work in teradata 12.0 but case statement can be used.

update stud set gender =
case gender
when 'male' then 'female'
when 'female' then 'male'
end;

Is This Answer Correct ?    24 Yes 1 No

id name gender 1 Ram Female 2 Kumar Female 3 sathish Female 4 San..

Answer / ankal

update stud set gender=
case gender when'male' then'female'
else 'male' end;

Is This Answer Correct ?    7 Yes 0 No

id name gender 1 Ram Female 2 Kumar Female 3 sathish Female 4 San..

Answer / kumar amit ranjan

UPDATE stud SET gender ='Z' WHERE gender ='F';
UPDATE studmaster SET gender ='F' WHERE gender ='M';
UPDATE studmaster SET gender ='M' WHERE gender ='Z';

Is This Answer Correct ?    3 Yes 2 No

id name gender 1 Ram Female 2 Kumar Female 3 sathish Female 4 San..

Answer / tdguy

update using case option is the best option for this query.

Is This Answer Correct ?    1 Yes 0 No

id name gender 1 Ram Female 2 Kumar Female 3 sathish Female 4 San..

Answer / srinu

update stud set gender= decode(gender,'M','F','F','M')

Is This Answer Correct ?    3 Yes 3 No

id name gender 1 Ram Female 2 Kumar Female 3 sathish Female 4 San..

Answer / apurva kumar

UPDATE table
SET Gender = CASE
WHEN Gender = 'Male' THEN 'Female'
ELSE 'Male'
END

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Teradata Interview Questions

If the script is aborted. why it is aborted and how can you identify ?

1 Answers  


What are the types of tables in Teradata

22 Answers   Cap Gemini, Cognizant, Infosys,


How you will check the version of teradata?

0 Answers  


one table have input no name 10 rao 20 siva 30 srinu 10 rao i want to ouput like this way no name 20 siva 30 srinu 10 rao how it posible in only sql server query?not oracle?

3 Answers   IBM,


What are the different table types supported by teradata?

0 Answers  






Why Multiload and Fastload does not supports SI,JI,RI and TRIGGERS?

4 Answers  


What is bteq script in teradata?

0 Answers  


Hello all, There is a table with 4 columns in that 3 columns has been already loaded with 5 million records.4th column is empty,Now I have got 5 million records data which has to be loaded into 4th column.How can I load this data fastly in to the 4th column with out using update

5 Answers   CTS, TCS,


What is logical data model?

0 Answers  


What are the newly developed features of Teradata?

0 Answers  


Can some one tell me the ressolution for the error. I was not able to answer this question in wipro interview. "The transaction exceeded the maximum number of rowhash locks allowed"

1 Answers   Wipro,


Write a single SQL to delete duplicate records from the a single table based on a column value. I need only Unique records at the end of the Query.

13 Answers  


Categories