Hi All,
I have a table with 3 fields like id,mark1,mark2 and I would
like to update a mark3 field that would calculate the max
for each record (so the max value of the 2 fields) in
Teradata
ID Mark1 Mark2 Mark3
1 10 20
2 20 30
3 40 10
4 50 50
I Have to write a update statement Mark3 with max value of
mark1,mark2 fields…like bellow
ID Mark1 Mark2 Mark3
1 10 20 20
2 20 30 30
3 40 10 40
4 50 50 50
Please any one help me ....Thq

Answers were Sorted based on User's Feedback



Hi All, I have a table with 3 fields like id,mark1,mark2 and I would like to update a mark3 field..

Answer / subbu

Hi NBK,

You can use the below UPD query to update the mark3 field
with maximum marks of Mark1 or Mark2 fields.

Update db_name.Tab_name
set mark3 = case
when mark1>mark2
then mark1
else mark2
end

Is This Answer Correct ?    13 Yes 0 No

Hi All, I have a table with 3 fields like id,mark1,mark2 and I would like to update a mark3 field..

Answer / tdguy

Above answer is correct. Update statement would be the best
option (with case).

Update tablename
set mark3 = case when mark1>mark2
then mark1 else mark2 end;

Is This Answer Correct ?    3 Yes 0 No

Hi All, I have a table with 3 fields like id,mark1,mark2 and I would like to update a mark3 field..

Answer / rajesh

I didnt understand ur question,give me correct question and
excat o/p u wanted ,send example o/p what u wanted

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Teradata Interview Questions

What are the various indexes in teradata? How to use them? Why are they preferred?

0 Answers  


tomorrow i have interview in infosys.can someone pour any suggestions or any interview questions. thank you

0 Answers  


What is spool space? Why do you get spool space errors? How do trouble-shoot them?

0 Answers  


i have column like below studentid studentname sub1 sub2 sub3 1 aaa 40 70 90 2 bbb 60 80 50 i want to execute every student highest mark in which subject my o/p like below studentid studentname sub3 sub2 1 aaa 90 2 bbb 80

12 Answers   CTS,


Explain the parallel data extension in teradata?

0 Answers  






What does Amp contain and what are all the operations that it performs?

0 Answers  


Explain vproc in teradata?

0 Answers  


What are the 5 phases in a multiload utility?

0 Answers  


Explain teradata vs. Redshift?

0 Answers  


which option is used to restart the fastexport script ?

2 Answers   TCS,


How is the teradata different from oracle?

0 Answers  


How do you do backup and recovery in teradata?

0 Answers  


Categories