| |
GeekInterview.com > Interview Questions > Oracle > SQL
| Print | |
Question: write a query to update third column such that
Answer: There is a table having the following columns :- student id marks1 marks2 maxmarks 1 10 20 20 2 25 30 30 3 30 10 30 4 35 25 35 5 20 40 40
write a query to update column maxmarks such that maxmarks column contains whatever be the greater value among marks1 and marks2 columns ( as shown in table ). |
| February 02, 2009 00:18:16 |
#9 |
| singh13 |
Member Since: February 2009 Total Comments: 2 |
RE: write a query to update third column such that |
update student a set a.maxmarks = (select greatest(marks1,marks2) from student b where a.student_id=b.student_id)
this is working for sure. |
| |
Back To Question | |