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
Is oracle an open source?
What is connection pool in oracle?
What do database buffers contain?
What is difference between truncate and delete?
is there a tool to trace queries, like profiler for sql server?
what is difference between sql plus and sql*plus? (not sql and sql plus).
How to change system global area (sga) in oracle?
How do I decide when to use right joins/left joins or inner joins or how to determine which table is on which side?
What is merge in oracle?
Explain oracle’s system global area (sga).
Explain the use of indexes option in imp command.
Is there an oracle sql query that aggregates multiple rows into one row?
How do I manually create a database in oracle?
What is control file used for?
What is tns entry?