The table has 3 columns 4 rows. The output is which column has least null values( A COL SHOULD BE THE OUTPUT)
Write the query plz.

A B C
----------
1 NULL 7
2 4 NULL
NULL 5 NULL
3 NULL NULL

Answer Posted / rameshganesan

Select (Case
When a = Least Then (select 'O/P A ='||ListAgg(a,' ') Within Group(order by a) from Least_Col)
When b =Least Then (select 'O/P B ='||ListAgg(b,' ') Within Group(order by b) from Least_Col)
Else (select 'O/P C ='||ListAgg(c,' ') Within Group(order by c) from Least_Col) end)ab
From (Select count(a) a,count(b) b,count(c) c,greatest(count(a),count(b),count(c)) Least From Least_Col);

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

defination of bitmap index

1621


What is the effect of setting the value "all_rows" for optimizer_goal parameter of the alter session command? What are the factors that affect optimizer in choosing an optimization approach?

520


A table t is there.If you perform insert ,update and delete then the trigger will fire.What is the minimum no of trigger required for a table.

4254


What are the system predefined user roles?

585


What is the difference between $oracle_base and $oracle_home?

580






How to divide query output into groups in oracle?

558


What does sharding mean?

537


How to test null values?

670


What is data type in oracle?

558


How remove data files before opening a database?

556


Is truncate autocommit in oracle?

633


How to update a table row with a record?

597


How to start your 10g xe server?

592


What is the difference between sharding and partitioning?

499


Explain an exception and its types?

607