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 2
NULL 3 4
NULL 5 6
7 NULL NULL
O/P
C
=
2
4
6
Answers were Sorted based on User's Feedback
Answer / rameshganesan
Select (Case
When a = Least Then (select 'A'||CHR(10)||'='||CHR(10)||ListAgg(a,CHR(10)) Within Group(order by a) from Least_Col)
When b =Least Then (select 'B'||CHR(10)||'='||CHR(10)||ListAgg(b,CHR(10)) Within Group(order by b) from Least_Col)
Else (select 'C'||CHR(10)|| '='||CHR(10)||ListAgg(c,CHR(10)) 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 ? | 1 Yes | 0 No |
How to write an inner join with the where clause in oracle?
How do you rate yourself in oracle and sql server ?
What is an Integrity Constrains ?
Can a Tablespace hold objects from different Schemes ?
Explain user account with reference to oracle.
which is best institue to learn oracle 11i in ameerpet or maithrivanam or sr nagar please help
is there a tool to trace queries, like profiler for sql server?
Explain what are synonyms used for?
What are the types of synonyms?
What is oracle datasource?
Can objects of the same Schema reside in different tablespaces.?
Why do you use stored procedures and state some of its disadvantages?