column A column b | output
10 7 | 10
5 8 | 8
7 -9 | 7
3 5 | 5
0 6 | 6

Write a sql query to print such output.

Answers were Sorted based on User's Feedback



column A column b | output 10 7 | 10 5 8 ..

Answer / apoorva garg

select a,b,
CASE WHEN (a>b) THEN a
ELSE b
END output
from a

Is This Answer Correct ?    9 Yes 0 No

column A column b | output 10 7 | 10 5 8 ..

Answer / satish tadepalli

select greatest(nvl(cola,0),nvl(colb,0)) from tablename

Is This Answer Correct ?    6 Yes 1 No

column A column b | output 10 7 | 10 5 8 ..

Answer / phani kumar

select greatest(cola,colb) from tblname;

Is This Answer Correct ?    2 Yes 0 No

column A column b | output 10 7 | 10 5 8 ..

Answer / suresh ramsng

select A,B,greatest(A,B) output from <tablename>

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

what are the features and advantages of object-oriented programming? : Sql dba

0 Answers  


Write a query to genarate target column.Please answer me. Advance Thanks. Src Tgt Q10 Quarter to 2010 Q90 Quarter to 1990 Q80 Quarter to 1980 Q74 Quarter to 1974

5 Answers   Infosys,


how to load data files into tables with 'mysqlimport'? : Sql dba

0 Answers  


If records are inserted into table without committing.How to refer to these values in a procedure?

2 Answers  


Hi how to import oracle sequence in Informatica? Please write stored procedure code that will import oracle sequence in Informatica SP transformation as per below scenario Oracle table product list Pro_id, pro_name 101, LED Lights. 102, 20watt CFL Lights. 103, 30 watt CFL lights Now a new flat file with new product list needs to be added to oracle table product list with oracle sequence. flat file product Prono,pro_name, 1, 20 watt tube light 2, 30 watt tube light & target should be like 101, LED Lights. 102, 20watt CFL Lights. 103, 30 watt CFL lights. 104, 20 watt tube light 105, 30 watt tube light thks reg suvarna joshi suvarnaatsuvarna@rediffmail.com

0 Answers   TCS,






what are myisam tables? : Sql dba

0 Answers  


What is meant by cursor in sql?

0 Answers  


table - new_no old_no 2345 1234 3456 2345 5678 4567 output sud be -new_no 1234 2345 3456 4567 5678

2 Answers  


What is the difference between inner join and natural join?

0 Answers  


Can we update views in sql?

0 Answers  


wht is the difference between sqlaserver2000 and 2005

1 Answers   ABC, IBM,


What is optimistic concurrency control? : Transact sql

0 Answers  


Categories