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

Can you have multiple SPs with the same name on a database?

6 Answers   CGI,


what is “go” in t-sql? : Transact sql

0 Answers  


How do I count rows in sql query?

0 Answers  


Does truncate table reset auto increment?

0 Answers  


how can we write a column values horizontal by using sql stmt; ex: select name from table_name;(actual output) a b c d require output is a b c d

5 Answers   Honeywell, Interact,






What is a mutating table and a constraining table?

0 Answers  


Is sql a backend?

0 Answers  


Write the sql query using dual table for below output? 1 L R --- --- ---- 1 1 1 1 2 1 1 3 1 1 1 2 1 2 2 1 3 2 1 1 3 1 2 3 1 3 3 Write a query using only Dual table with out writing any pl/sql program.

3 Answers   JPMorgan Chase,


Can i use Commit inside the Trigger? Suppose i use commit what will be happy (it's complied /executed/work)

6 Answers  


What are keys in sql?

0 Answers  


Why does sql need a server?

0 Answers  


tell us something about heap tables. : Sql dba

0 Answers  


Categories